-
- To All The Masters - How do I get the correct font.Charset from a RichTextBox?
I’m trying 2 get fonts Charset from a RichTextBox
The font Script (Charset) is set 2 “Western” and when I click the Alt – Shift buttons the text in the RichTextBox is in any fonts language (“Hebrew”, ‘Arabic”, “Spanish” ….. and “Western”) as were installed in my Windows system.
I want to emphasis, my problem is only when I press alt-shift, it works perfectly when I manually choose the font from the font list.
For example:
Assuming the language is set to “western”, which is the default option in most of our computers, and now I want 2 write in a different language, I press alt-shift.
When I ask in my Project:
“x = RichTextBox. Charset”, I get “x=0” (Western).
This is not the printed language that I typed in the RichTextBox,
I want to be able 2 get the right fonts name (for example: Arial (Western -Hebrew)), meaning, I want 2 get “x=177”.
How can I get the correct font.Charset from my RichTextBox Control?
How the **** did Microsoft made that function work in their WordPad and all of their Pads programs???
Can any one please help me? It’s really hard 4 me 2 get it.
I was in all the forums and I searched google but I couldn’t find what I was looking 4 and I know that it can be done.
-
imosha,
I do not know if you are the same I answered to in the wrox forum.
Did you try to catch the alt+shift in the richText keyDown event:
If KeyCode = vbKeyShift And Shift = (vbAltMask + vbShiftMask) Then
'' check for the current input locale, and set the font charset here
End If
this works with me (I can't test Hebrew because I do not have it installed)
Marco
"There are two ways to write error-free programs. Only the third one works."
Unknown
-
Yes it’s me
I was also thinking abut that way
How can i "check for the current input locale?”
Do you have the code or where can i find it?
Please you are the only one that makes sense.
Thank u 4 all the help that u giving me 
i will search the code tomorrow u are a life saver
Last edited by imosha; 07-20-2005 at 07:17 PM.
-
Use this API:
Private Declare Function GetKeyboardLayout Lib "user32" (ByVal dwLayout As Long) As Long
dim k as long
k = GetKeyboardLayout(0)
unfortunatelly, the input locale does not change right way when you press alt+shift.
what I do, is to set a timer (1 second), and test the language there. This is my code:
Code:
Private Declare Function GetKeyboardLayout Lib "user32" (ByVal dwLayout As Long) As Long
Private Const LANG_HEBREW = &HD&
Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyShift And Shift = (vbAltMask + vbShiftMask) Then
Timer1.Enabled = True
End If
End Sub
Private Sub Timer1_Timer()
Timer1.Enabled = False
Dim k As Long
k = GetKeyboardLayout(0)
If (k And &HFF) = LANG_HEBREW Then
'' do something
End If
End Sub
hope this helps,
Marco
"There are two ways to write error-free programs. Only the third one works."
Unknown
Similar Threads
-
By mdengler in forum ASP.NET
Replies: 0
Last Post: 11-26-2002, 03:32 PM
-
Replies: 7
Last Post: 08-03-2002, 11:16 AM
-
By Richard in forum Careers
Replies: 5
Last Post: 06-15-2001, 09:11 AM
-
By James in forum VB Classic
Replies: 2
Last Post: 10-22-2000, 08:14 PM
-
By James in forum VB Classic
Replies: 0
Last Post: 10-21-2000, 05:56 PM
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
|
Development Centers
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center
|