For Programmers: Free Programming Magazines  


Home > Archive > Visual Basic > May 2005 > Changing the Font codepage









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Changing the Font codepage
Strider

2005-05-30, 3:55 pm

Hello all.

I have an application that needs to display it's forms and controls captions
in many different languages (including Engilsh, Gr and Bulgarian).
This needs to be done without changing the system's "Language for non
unicode programs" setting.

So I change the Font.Charset property runtime, for each control contained
into the form and for the form itself. This works fine for some controls (eg.
Label, Textbox) but some others (eg. CommandButton) do not display the
correct codepage although their Font property accepts it. The same applies to
the form itself where the caption and the menu elements are not displayed
with the correct codepage

Is there any way to overcome this behaviour?

Code Sample:


Public Sub TranslateForm(ByRef frmMyForm as Form)

Dim fnt As Font
Dim ctrl As Control

set fnt = frmMyForm.Font
fnt.Charset = 204 'eg Cyrillic
set frmMyForm.Font = fnt

'Code that changes the form's caption for the selected
'language goes here

For Each objControl In frmMyForm.Controls

Set fnt = ctrl.Font
fnt.Charset = 204 'eg Cyrillic
Set ctrl.Font = fnt

'Code that changes the control's caption for the selected
'language goes here

Next objControl

End Sub

Any help or hint would be greatly appreciated!
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com