Make the background of a Label or LinkLabel transparent
Is it possible to make the background of a LinkLabel transparent?
Setting the BackColor to the Transparent syste开发者_运维问答m color does not work. Matching the BackColor of the container is not suitable because the container is an image.
If your label lies on top of a picturebox or panel, you have to set the picturebox or panel as the label's parent in addition to setting .BackColor to Color.Transparent:
myLabel.Parent = myPicturebox;
myLabel.BackColor = Color.Transparent;
The reason for this is that Color.Transparent doesn't actually mean "transparent", it means "inherit the background color of your parent". And by default, the parent of your label is the form (or containing control), not the picturebox.
精彩评论