Hello,
I have a myFormClass inherited from System.Windows.Forms.Form class (C# 2013 .Net 4),
and set the RightToLeft property value to Yes and RightToLeftLayout to True from Properties grid window.
Now I inherit the Form1, from myFormClass (that created automatically when I create new project).
Then I set an image for Form1.BackgroundImage and set the BackgroundImageLayout to Stretch, but the image don't show.
After googling, I found a solution from StackOverflow, to override the form OnPaintBackground method. Therefore I override the OnPaintBackground method in myFormClass.
using System.Drawing;
using System.Windows.Forms;
protected override void OnPaintBackground(PaintEventArgs e)
{
if ((RightToLeftLayout) && (RightToLeft == RightToLeft.Yes))
{
Image bgImage = BackgroundImage;
e.Graphics.DrawImage(bgImage, new Rectangle(Point.Empty, this.ClientSize));
}
else
base.OnPaintBackground(e);
}
So far every thing is OK.
But...
When I place some CommandButtons on Form1, the buttons borders don't display correctly after run project and resize the form.
If I move the mouse cursor on buttons, the borders refreshed and fixed but there is some problems yet.
What is your suggestion?