I am sure that my question or problem is really strange but this is it:
I am writing a program in c# which has a right to left layout (Arabic language). I am then adding the pictureBox
control to be a background image in the form. I have set the dock of the pictureBox
to be fill so it will be all the form.
Since the picture has some design that involves more than one color, I want to make the label transparent so that it does not have any color and it will take the color from the pictureBox
itself. Here is how I make the label transparent:
label_customer_name.Parent = pictureBox1;
label_customer_name.BackColor = Color.Transparent;
This method works fine to change the color to transparent but there is a problem. When I set the parent of the label to be the pictureBox
, the location of it changes and gets reflected on the other side. For example, if the location is set to be X after the execution, the location will be the form width - x. Any idea how to get rid of this problem?
What I am looking for in brief is:
Is there any other way to make the label transparent without setting the parent to the container control? Or
How to change the layout of PictureBox
and force it to be from left to right.
Just as hint and the funny thing is that: if I add the pictureBox
to a tab control and set the tab control to be right to left, the problem disappears as it seems that the pictureBox
will get the layout from the tab control but it does not get it from the form itself.
Using GDI+ for Drawing Images with Transparency.
see this .
http://www.codeproject.com/Articles/25048/How-to-Use-Transparent-Images-and-Labels-in-Window
Good luck
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With