Reputation:
I set background image to form in my project C# winform, but when set Form property to
RightToLeft=Yes and RightToLeftLayout=True
then disappear my background image.
Does anyone help me?
Upvotes: 5
Views: 1165
Reputation: 506
By using background image, you have to know that it is not supported by RightToLeftLayout
so you cannot use it directly in this case, but that doesn't mean that you can't implement it manually.
Upvotes: 1
Reputation: 215
You can paint the image manually, by overriding the OnPaintBackground
method of your form:
protected override void OnPaintBackground(PaintEventArgs e)
{
e.Graphics.DrawImage(Properties.Resources.SampleImage,
new Rectangle(Point.Empty, this.ClientSize));
}
Upvotes: 4
Reputation: 1372
http://msdn.microsoft.com/en-us/library/system.windows.forms.control.backgroundimage(v=vs.110).aspx
If you set RightToLeftLayout=True ,you'll not use backgroundimage.
Upvotes: 0
Reputation: 579
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.
Referece:
Upvotes: 0