1 Attachment(s)
VB6 Real Unicode Display in Rich Edit without installing RICHTX32.OCX
Hi Guys!
I combined two nice features for a part of my project and I decided to share it with you. Well, I had three challanges when I was doing this:
1. Use a RichTextBox for unicode display;
2. Use real unicode characters like superscript numbers (not fake offsets)
3. Not to use a setup which is nearly a must if you are using RichTextBox control to copy and register RICHTX32.OCX file. (because my project was only 380KB which looks stupid for a setup.)
Infact, I did a very small part of the job. This is a nice combination of two different modules written by some other hardworking people.
After a long research dilettante suggested me this project to display real unicode contents RTB Superscript.zip. It is written only "Superscript" but it does a quite well job with unicodes, too... However, only compatible with RichText Box object...
At first I was very happy with this but then I realized that it causes error on computers which has no RICHTX32.OCX file in System 32 folder.
I sworn my not to use setup for a 380KB project.
Then in another thread ,again dilettante, suggested me a code (Naked RichEdit.zip) which draws it's own RichTextBox which is only depending on "riched20.dll", nearly found in any PC.
Then I made some tweaks, modifications and combined them, droped some notes into code to help for some basic features.
And TA-TAA:
Attachment 95963 !!!
I hope someone will find it useful, too...
PS: If anybody knows how to change the font in the code, please do let me know :D
Re: Real Unicode Display in RichTextBox without RICHTX32.OCX
Hi! :) Check out Unicode RichEdit (don't support Pictures)!
You can change the font used for all characters by sending the WM_SETFONT message. To set the font for any or all characters, use the EM_SETCHARFORMAT message.
Re: Real Unicode Display in RichTextBox without RICHTX32.OCX
I didn't get it, can you give a sample fragment? For example, for Arial?
By the way, despite it is a very powerful tool for text editting; it needs much much much more modification for simple usage.
Re: VB6 Real Unicode Display in RichTextBox without installing RICHTX32.OCX
I think there's a thread here in the CodeBank that deals with the RTB. It contains a lot of tips and tricks. I can't remember the title of that thread though...
Re: VB6 Real Unicode Display in RichTextBox without installing RICHTX32.OCX
Scratching my head here. In I have a dream...about RICHTX32.OCX I provided an example just today that does that:
Code:
'Set the control to use the form's font
hFont = GetCurrentObject(hDC, OBJ_FONT)
SendMessage hWndRichEd, WM_SETFONT, hFont, 1
Or a variation might be:
Code:
'Set the control to use a specific font.
Dim ifnt As IFont
Set ifnt = New StdFont
With ifnt
.Name = "Arial"
.Size = 14
SendMessage hWndRichEd, WM_SETFONT, .hFont, 1
End With
Set ifnt = Nothing
Re: VB6 Real Unicode Display in RichTextBox without installing RICHTX32.OCX
Yesss, I mentioned about it in my post. Thanks for the font tip!