Search code examples
user-controlslabelgradienttransparent-control

Transparency problem with gradient - Label in a Panel on a UserControl, ultimately displayed on parent Form


I know this has been asked many times, but not quite the way I'm trying to solve it.

I have Labels in a Panel on a UserControl, and the UserControl goes onto a form.

The Label.BackColor = Transparent.

The panel is from DevExpress, and I've set a gradient background.

Problem: The Labels aren't transparent; they each show as a white solid rectangle around the text. (I presume the white comes from the Panel, as the first of the two gradient colors is White.)

Everything I google about this problem says I need to roll my own Label control and fire off peculiar GDI+ commands, and Invalidate the control, and hook the Paint event and sing a stirring sea shanty and hold one foot above my head and...

Really? Doesn't the Label allow ".BackColor=Transparent" ? Why doesn't that work?

And what's the best way through this?


Solution

  • Somehow it turns out I never tried making the Label backgrounds transparent.

    I am not a proud.