Serialcoder en Français Serialcoder in English
TEL : +33 (0)9 72 13 15 17

Windows Forms FAQ resources

2. Windows Forms Controls

2.28 I'm trying to make the background of my linklabel transparent so a picturebox will show through it. However, if I set the link label's BackColor property to Transparent the label still has a white background. Why?


Controls with a "Transparent" color actually render their parent's background, so you're seeing the White background of the Form, not the PictureBox. Three easy ways to deal with this:

  • Use a Panel with it's "BackgroundImage" property set instead of a PictureBox, and parent the LinkLabels to the panel (PictureBoxes generally don't have children)
  • Set the BackgroundImage of the Form to the image (basically the same as 1 above, but avoids the extra control)
  • In code, set the Parent of the LinkLabel to be the PictureBox. You'll need to update the LinkLabel's position to match the new origin of the parent if the PictureBox isn't at (0,0)
(Shawn Burke on microsoft.public.dotnet.framework.windowsforms newsgroup)