Form.RightToLeftLayout 属性


获取或设置一个值,该值指示是否打开从右向左的镜像放置。Gets or sets a value indicating whether right-to-left mirror placement is turned on.

 virtual property bool RightToLeftLayout { bool get(); void set(bool value); };
public virtual bool RightToLeftLayout { get; set; }
member this.RightToLeftLayout : bool with get, set
Public Overridable Property RightToLeftLayout As Boolean


如果打开了从右到左的镜像放置,则为 true;否则对于标准子控件放置,为 falsetrue if right-to-left mirror placement is turned on; otherwise, false for standard child control placement. 默认值为 falseThe default is false.


RightToLeftLayout 属性主要适用于为全球受众开发全球通用表单。The RightToLeftLayout property is primarily useful for developing world-ready forms for worldwide audiences. 许多窗体的设计使控件按从左到右的方式放置在窗体上。Many forms are designed so that controls are laid out on a form in a left-to-right fashion. 这些表单与遵循这种书写方向的语言兼容。These forms are compatible with languages that follow this writing direction. 但是,当您向从右到左的语言的用户显示相同的窗体时,通常最好反转窗体上控件的顺序。However, when you display the same forms to users of right-to-left languages, it is often preferable to reverse the order of the controls on the form. 如果 RightToLeftLayoutRightToLeft 属性均 true,则将为窗体打开镜像,并且控件位置和文本流将从右到左。If both the RightToLeftLayout and RightToLeft properties are true, mirroring will be turned on for the form, and control placement and text flow will be right-to-left.

RightToLeft 不同,RightToLeftLayout 不继承。Unlike RightToLeft, RightToLeftLayout does not inherit. 如果希望它对子控件生效,则必须在每个要镜像的子控件上进行设置。If you want it to take effect for child controls, you must set it on each child control that you want mirrored.

RightToLeftLayout 设置为 Yes时不支持所有者描述。Owner draw is not supported when RightToLeftLayout is set to Yes. 所有者绘制事件仍将发生,但未定义你在这些事件中创作的任何代码的行为。The owner draw events will still occur, but the behavior of any code you author in these events is not defined. 此外,不支持 BackgroundImageOpacityTransparencyKey 和绘制事件。Additionally, BackgroundImage, Opacity, TransparencyKey, and the painting events are not supported.

RightToLeftLayoutRightToLeft 属性将导致设置以下 Windows API 窗口样式:The RightToLeftLayout and RightToLeft properties cause the following Windows API window styles to be set:

  • 如果将 RightToLeft 设置为 Yes 并将 RightToLeftLayout 设置为 true,Windows 窗体将设置 WS_EX_LAYOUTRTL 窗口样式,并删除 WS_EX_RIGHTWS_EX_RTLREADING 样式。When RightToLeft is set to Yes and RightToLeftLayout is set to true, Windows Forms sets the WS_EX_LAYOUTRTL window style, and removes the WS_EX_RIGHT and WS_EX_RTLREADING styles.

  • 如果 RightToLeft 设置为 YesRightToLeftLayout 设置为 No,Windows 窗体将设置 WS_EX_RIGHTWS_EX_RTLREADING 窗口样式。When RightToLeft is set to Yes but RightToLeftLayout is set to No, Windows Forms sets the WS_EX_RIGHT and WS_EX_RTLREADING window styles.

更改此属性的值将引发 RightToLeftLayoutChanged 事件。Changing the value of this property raises the RightToLeftLayoutChanged event.

有关全球化问题的详细信息,请参阅开发全球通用应用程序的最佳实践For more information about globalization issues, see Best Practices for Developing World-Ready Applications.