Reputation: 3051
In Windows Form When
RightToLeft=yes
and
RightToLeftLayout=true
i can not
set any background image for my form!
Upvotes: 0
Views: 1438
Reputation: 11399
According to Prshanth's answer, you need to handle the background painting yourself.
Microsoft wasn't lazy, they simply didn't know what you want to be happening when the reading layout of the form is changed. Perhaps you want your background image to be flipped? They just don't know, so instead of doing something wrong, they did nothing.
The good thing is that you can simply do it yourself like this. In this example, I simply store the desired background image in a PictureBox and then paint it onto the form when the Form.Paint event occurs:
Private Sub Form1_Paint(sender As Object, e As PaintEventArgs) Handles Me.Paint
Dim r As Rectangle = Me.ClientRectangle
e.Graphics.DrawImage(Me.PictureBox1.BackgroundImage, r)
End Sub
Upvotes: 2
Reputation: 11
add a PictureBox and dock it to fill the form and you’ll get a background
Upvotes: 1
Reputation: 4361
From the MSDN entry for the Form.RightToLeftLayout
property:
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.
Upvotes: 3