开发者

VCL form and control font settings under Russian version of MS Windows

开发者 https://www.devze.com 2022-12-24 21:00 出处:网络
I have a Borland C++ Builder VCL app (so I am not working with Unicode yet), I want to provide a simple translation of controls\' caption text to Russian at runtime.

I have a Borland C++ Builder VCL app (so I am not working with Unicode yet), I want to provide a simple translation of controls' caption text to Russian at runtime.

I can easily use EnumChildWindows to get the English caption, then lookup the translation and replace the caption text using SetWindowText. This does work well for my western European translations where I don't have to worry about the font. But I am not sure how the Russian version of Windows and then VCL handles 8 bit cyrillic character sets.

Currently all the VCL controls have the font settings:

Charset=DEFAULT_CHARSET
name=MS Sans Serif

Am I 开发者_运维技巧correct in assuming that when my program is run under a Russian version of Windows the character set will be cyrillic with the DEFAULT_CHARSET setting so I won't need to change the font settings in all my controls?

If I do have to change the font (at run time), should the Windows API function SendMessage(hwnd,WM_SETFONT,(WPARAM)hFont,TRUE) work with VCL controls ? I have tried using the CreateFont() and SendMessage(..WM_SETFONT..) with RUSSIAN_CHARSET and a cyrillic font face. This doesn't appear to have any effect, it keeps the font that was set for the control in the form at design time (even ANSI_CHARSET and a standard Windows-installed font face doesn't affect the controls' font) so I looking for confirmation that I won't have to change the font of the controls, or else tell me some VCL method for setting all the controls' font settings at runtime .


There is no need to reinvent the bicycle. Why don't you use Integration Translation Environment Tools which are provided with Borland C++Builder? There is a wizard that will help you with translations and will make a special resource file which will contain translation of all text strings in your application. Then program, will check system language and availible language resource files at startup, and will automatically use appropriate language. Check C++Builder help system with index - "Integrated Translation Environment (ITE)" for more detailed process description.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号