I want to move the form title, icon and close, and help buttons from left side to right side (change the layout).
我想从左侧到右侧移动表单标题,图标和关闭以及帮助按钮(更改布局)。
I moved the form controls manually to keep background image but now I want to change the form title.
我手动移动表单控件以保留背景图像,但现在我想更改表单标题。
When I set rightToLeft property to yes and rightToLeftLayout to true in the form properties the background image disappears, but it uses the property "BackColor"
当我在表单属性中将rightToLeft属性设置为yes并将rightToLeftLayout设置为true时,背景图像消失,但它使用属性“BackColor”
My code is as follows:
我的代码如下:
if (_lang == 'Arabic')
{
this.RightToLeft = RightToLeft.Yes;
this.RightToLeftLayout = true;
}
But it keeps buttons image.
但它保持按钮图像。
So why is that?
那为什么呢?
3 个解决方案
#1
To further Blounty's answer, the MSDN specs clearly state that BackgroundImage, Opacity and others aren't supported when using RightToLeftLayout:
为了进一步了解Blounty的答案,MSDN规范明确指出在使用RightToLeftLayout时不支持BackgroundImage,Opacity等:
http://msdn.microsoft.com/en-us/library/system.windows.forms.form.righttoleftlayout(vs.80).aspx:
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. Additionally, BackgroundImage, Opacity, TransparencyKey, and the painting events are not supported.
当RightToLeftLayout设置为Yes时,不支持所有者绘制。所有者绘制事件仍将发生,但未定义您在这些事件中创作的任何代码的行为。此外,不支持BackgroundImage,Opacity,TransparencyKey和绘画事件。
#2
BackgroundImage, Opacity, TransparencyKey, and the painting events are not supported when RightToLeftLayout is set to yes.
当RightToLeftLayout设置为yes时,不支持BackgroundImage,Opacity,TransparencyKey和绘制事件。
#3
It is pretty easy to replace the lost functionality:
替换丢失的功能非常容易:
protected override void OnPaintBackground(PaintEventArgs e) {
Rectangle rc = new Rectangle(Point.Empty, this.ClientSize);
e.Graphics.DrawImage(Properties.Resources.SampleImage, rc);
}
You'll need to do a bit more work if you need to tile the image.
如果需要平铺图像,则需要做更多工作。
#1
To further Blounty's answer, the MSDN specs clearly state that BackgroundImage, Opacity and others aren't supported when using RightToLeftLayout:
为了进一步了解Blounty的答案,MSDN规范明确指出在使用RightToLeftLayout时不支持BackgroundImage,Opacity等:
http://msdn.microsoft.com/en-us/library/system.windows.forms.form.righttoleftlayout(vs.80).aspx:
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. Additionally, BackgroundImage, Opacity, TransparencyKey, and the painting events are not supported.
当RightToLeftLayout设置为Yes时,不支持所有者绘制。所有者绘制事件仍将发生,但未定义您在这些事件中创作的任何代码的行为。此外,不支持BackgroundImage,Opacity,TransparencyKey和绘画事件。
#2
BackgroundImage, Opacity, TransparencyKey, and the painting events are not supported when RightToLeftLayout is set to yes.
当RightToLeftLayout设置为yes时,不支持BackgroundImage,Opacity,TransparencyKey和绘制事件。
#3
It is pretty easy to replace the lost functionality:
替换丢失的功能非常容易:
protected override void OnPaintBackground(PaintEventArgs e) {
Rectangle rc = new Rectangle(Point.Empty, this.ClientSize);
e.Graphics.DrawImage(Properties.Resources.SampleImage, rc);
}
You'll need to do a bit more work if you need to tile the image.
如果需要平铺图像,则需要做更多工作。