|
-
Jul 11th, 2000, 10:37 PM
#1
Thread Starter
Addicted Member
I'm starting the beta 2 of the program I talked about in
http://forums.vb-world.net/showthrea...threadid=21608
OK. What I am going to do is have the user create a msg in a rtf box with pictures and differnt SelText states (SelBold,SelColor, so on) I don't see any big problems yet, but I am just now building the form to create the rtf part of the program. I have code to translate rtf formated text from the rtfBox to html code using a start and end postion. (I didn't write the code myself so am not familer with it completely yet but I am rewriting now)
The code is below I believe it will handle everything fine but I will have to do it one color at a time so I'll have to get the dif colors and the start and end postions of each then cyle through and converts each line word a letter depending on the user. I haven't used this yet so I am speaking of the way I belive the code will work. I just want some inout and if anybody knows a better way clue me in.
If anyone is curios this code came from MonkeFade# an AOL bas from about 2 years ago. give credit where its due...
Function Rich2HTML(RichTXT As Control, StartPos%, EndPos%)
'by monk-e-god
Dim Bolded As Boolean
Dim Undered As Boolean
Dim Striked As Boolean
Dim Italiced As Boolean
Dim LastCRL As Long
Dim LastFont As String
Dim HTMLString As String
For posi% = StartPos To EndPos
RichTXT.SelStart = posi%
RichTXT.SelLength = 1
If Bolded <> RichTXT.SelBold Or posi% = StartPos Then
If RichTXT.SelBold = True Then
HTMLString = HTMLString + "<b>"
Bolded = True
Else
HTMLString = HTMLString + "</b>"
Bolded = False
End If
End If
If Undered <> RichTXT.SelUnderline Or posi% = StartPos Then
If RichTXT.SelUnderline = True Then
HTMLString = HTMLString + "<u>"
Undered = True
Else
HTMLString = HTMLString + "</u>"
Undered = False
End If
End If
If Striked <> RichTXT.SelStrikeThru Or posi% = StartPos Then
If RichTXT.SelStrikeThru = True Then
HTMLString = HTMLString + "<s>"
Striked = True
Else
HTMLString = HTMLString + "</s>"
Striked = False
End If
End If
If Italiced <> RichTXT.SelItalic Or posi% = StartPos Then
If RichTXT.SelItalic = True Then
HTMLString = HTMLString + "<i>"
Italiced = True
Else
HTMLString = HTMLString + "</i>"
Italiced = False
End If
End If
If LastCRL <> RichTXT.SelColor Or posi% = StartPos Then
ColorX = RGB(GetRGB(RichTXT.SelColor).Blue, GetRGB(RichTXT.SelColor).Green, GetRGB(RichTXT.SelColor).Red)
colorhex = RGBtoHEX(ColorX)
HTMLString = HTMLString + "<Font Color=#" & colorhex & ">"
LastCRL = RichTXT.SelColor
End If
If LastFont <> RichTXT.SelFontName Then
HTMLString = HTMLString + "<font face=" + Chr(34) + RichTXT.SelFontName + Chr(34) + ">"
LastFont = RichTXT.SelFontName
End If
HTMLString = HTMLString + RichTXT.SelText
Next posi%
Rich2HTML = HTMLString
End Function
Thankz
I'll probably be posting something about the picture aspect soon I'm going to get the text working the add to that...
Magiaus
Visual Basic 6.0 SP5
Visual C++ 6.0 SP5
The only sovereign you can allow to rule you is reason.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|