user3611808
user3611808

Reputation:

Hidden background image C# winform in right to left layout?

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

Answers (4)

Lynx
Lynx

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.

MSDN Reference

Upvotes: 1

Sasan007
Sasan007

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

Meysam Tolouee
Meysam Tolouee

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:

[http://msdn.microsoft.com/en-us/library/system.windows.forms.form.righttoleftlayout(v=vs.110).aspx][1]

Upvotes: 0

Related Questions