Romo Daneghyan
Romo Daneghyan

Reputation: 2189

Windows Forms, Right To Left Layout BG Image not showing

I have a Right To Left layout applied to my form. And there is a form, which has a background image, and it is not showing up when RightToLeft is true. What's the Problem ? Thanks

Upvotes: 0

Views: 1486

Answers (1)

Hassan
Hassan

Reputation: 5430

Check Remarks section here on MSDN.

For the Form.RightToLeftLayout Property:

BackgroundImage, Opacity, TransparencyKey, and the painting events are not supported.

Workaround (After setting RightToLeftlayout = true add a Panel and set its background image):

this.RightToLeftLayout = true;
Panel pnl = new Panel();
pnl.Dock = DockStyle.Fill;
pnl.BackgroundImage = System.Drawing.Image.FromFile("D:\\background.png");
pnl.BackgroundImageLayout = ImageLayout.Stretch;   
this.Controls.Add(pnl);
pnl.SendToBack();

Upvotes: 4

Related Questions