Search code examples
c#winformstransparency

Reasons for why a WinForms label does not want to be transparent?


Why can't I set the BackColor of a Label to Transparent? I have done it before, but now it just don't want to...

I created a new UserControl, added a progressbar and a label to it. When I set the BackColor of the label to transparent it is still gray =/ Why is this?

What I wanted was to have the label on top of the progressbar so that its text was "in" the progressbar...


Solution

  • WinForms doesn't really support transparent controls, but you can make a transparent control yourself. See my answer here.

    In your case you should probably subclass the progress bar and override the OnPaint method to draw a text on the progress bar.