Transparent Label
-
Hi, I want create a Label with transparent Color as "Color.FromArgb(40, 0, 0, 255)" how can I do? Please help me
-
Hi, I want create a Label with transparent Color as "Color.FromArgb(40, 0, 0, 255)" how can I do? Please help me
-
do it on the form_load event: label.backcolor = color.fromargb(40,0,0,255)
Posted by The ANZAC
My problem is that Label did not transparent to other controls on form. in example : if you have a PictureBox on form and a Label over the PicturBox ,Back Color of Label Cover the pictureBox and Part of PictureBox that is behind of Label is not visible. How i can set transparent color to label for All controls;
-
My problem is that Label did not transparent to other controls on form. in example : if you have a PictureBox on form and a Label over the PicturBox ,Back Color of Label Cover the pictureBox and Part of PictureBox that is behind of Label is not visible. How i can set transparent color to label for All controls;
It won't do that. There is a very common misconception that setting the BackColor to Transparent will make the label actually transparent. NO, it won't! When that control is redrawn, its Background takes on the background properties of it's parent container. It does NOT show other controls through it. In order to do this, you have to make your own label control, inheriting from the existing label. Override the it's OnPaintBackground method, and just don't paint that background and you should, in theory, get what you want.
Dave Kreskowiak Microsoft MVP - Visual Basic
-
It won't do that. There is a very common misconception that setting the BackColor to Transparent will make the label actually transparent. NO, it won't! When that control is redrawn, its Background takes on the background properties of it's parent container. It does NOT show other controls through it. In order to do this, you have to make your own label control, inheriting from the existing label. Override the it's OnPaintBackground method, and just don't paint that background and you should, in theory, get what you want.
Dave Kreskowiak Microsoft MVP - Visual Basic
-
Dear Dave Kreskowiak Thank You, but I found simple way. I add Label to PictureBox as : Label1.BackColor=Color.Transparent; PictureBox1.Controls.Add(Label1); in conclude Label1 is transparent to PictureBox Regards
I must not be getting what you said in your original post. I thought you wanted the controls in the same container to show through the label. Apparently, that's not the case. From what I'm not gathering, you just wanted a picture to show through the label.
Dave Kreskowiak Microsoft MVP - Visual Basic