属性表 (MFC) 的 RTL 布局问题

2022-01-12 00:00:00 windows visual-c++ c++ mfc

我正在阿拉伯语 Windows 中运行我的英语应用程序.它包含一个属性表 UI (MFC).一切似乎都很好(从左到右或 LTR),除了从右到左或 RTL 的按钮(确定、取消、应用和帮助).但是如何使按钮 LTR?

I am running my English application in Arabic Windows. It contains a property sheet UI (MFC). Everything seems to be fine (Left-To-Right or LTR), except the buttons (OK, Cancel, Apply, and Help) which are Right-To-Left or RTL. But how to make the buttons LTR?

  • 我玩过 MSDN 上提到的 PSH_RTLREADING 标志,但它只处理窗口标题,而不处理按钮.

  • I played around with the flag PSH_RTLREADING mentioned on MSDN but it only deals with the window caption, not the buttons.

此外,我注意到 这个讨论 但没有好的解决方案.

Besides, I noticed this dicussion but there is not a good solution.

推荐答案

由Raymond Chen [1] 和另一位微软员工[2] 给出答案;您必须从您的 CDialog(又名 CPropertySheet)创建的窗口中的按钮中删除 WS_EX_LAYOUTRTL 样式.您可以在创建 CMainFrame 并将其继承到所有子窗口时全局执行此操作,也可以通过从 GWL_EXSTYLE 更改窗口样式在本地执行此操作.

The answer is given by Raymond Chen [1] and another Microsoft employee [2]; you have to remove the WS_EX_LAYOUTRTL style from the buttons in the window created by your CDialog (aka CPropertySheet). You can either do this globally when you create your CMainFrame and inherit it to all child windows, or locally by changing the window style from GWL_EXSTYLE.

[1] http://blogs.msdn.com/b/oldnewthing/archive/2010/06/11/10023274.aspx

[2] http:///social.msdn.microsoft.com/Forums/en/vcgeneral/thread/057612e7-6cd4-44cf-a746-6370ace5de09

相关文章