views:

545

answers:

3

Dear all;

Ok, what if I want to move the form title, icon and close,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"

My code is as follows:

        if (_lang == 'Arabic')
        {
            this.RightToLeft =  RightToLeft.Yes;
            this.RightToLeftLayout = true;
        }

But it keeps buttons image

So why is that ?!?

+2  A: 

Hi,

BackgroundImage, Opacity, TransparencyKey, and the painting events are not supported when RightToLeftLayout is set to yes.

Blounty
+3  A: 

To further Blounty's answer, the MSDN specs clearly state that BackgroundImage, Opacity and others aren't supported when using RightToLeftLayout:

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.

Cory Foy
+1  A: 

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.

Hans Passant
where should i add the call of this function and how
Eng.Basma
Just paste it into your form.
Hans Passant