开发者

Make the background of a Label or LinkLabel transparent

开发者 https://www.devze.com 2023-01-17 01:03 出处:网络
Is it possible to make the background of a LinkLabel transparent? Setting the BackColor to the Transparent syste开发者_运维问答m color does not work.

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消