开发者

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.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜