Why won't label background actually set to transparent?

I have a label and for some reason it just won't set to transparent and it is driving me nuts...

http://i69.photobucket.com/albums/i53/adwins04/summary.jpg
http://i69.photobucket.com/albums/i53/adwins04/properties.jpg

In the picture it is the label that says Summary.

[594 byte] By [adwins04] at [2007-12-23]
# 1

Whats the control on which summary is sitting on? (panel? form?)

try control->right click 'send to back' .

SriramRajamanuri at 2007-8-31 > top of Msdn Tech,Windows Forms,Windows Forms General...
# 2
I don't know why but this problem mysteriously just worked itself out. Maybe it was just having some painting confusion or something....
adwins04 at 2007-8-31 > top of Msdn Tech,Windows Forms,Windows Forms General...
# 3

I changed the question to be a comment instead as it now seems to be solved, but not sure why.

AndreasJohansson at 2007-8-31 > top of Msdn Tech,Windows Forms,Windows Forms General...
# 4
QUOTE: (Dave S. Anderson wrote)

The

transparent property for the label control actually works quite

interestingly. When you set a labels back color to transparent, it IS

transparent to other controls on the form, but it will take on the back

color of the form itself.

For example, if I have a label on top

of a picture box. Say the picture box is white, and the labels

background is set to transparent. And the forms background is set to

control. The label background will be transparent to the picture box,

but will take on the back color of the form.

Meaning, the label is transparent to everything, BUT the form.

The

fix for doing this is set the background color of the label to

something that you would never normally use such as "hotpink" and set

the forms TransparencyKey to "hotpink".



I discussed this in another topic and explained a fix for it.

Topic url: http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=671233&SiteID=1

DaveS.Anderson at 2007-8-31 > top of Msdn Tech,Windows Forms,Windows Forms General...
# 5

It seems that when backcolor=transparent, lable control will use the same way which your form's onpaint method do, to redraw its background.

add a lable "lable1" and set its backcolor to transparent. Try following code, you will notice that the lable redraw its background with a red rectangle on the topleft, the same as the form's onpaint do.



protected override void OnPaint(PaintEventArgs e)
{
SolidBrush redbrush = new SolidBrush(Color.Red);
Rectangle rect = new Rectangle(e.ClipRectangle.X, e.ClipRectangle.Y, e.ClipRectangle.Width/2 , e.ClipRectangle.Height/2 );
e.Graphics.FillRectangle(redbrush, rect);
base.OnPaint(e);
}
private void Form1_Load_1(object sender, EventArgs e)
{
this.SetStyle(ControlStyles.SupportsTransparentBackColor, true);
label1.BackColor = Color.Transparent;
}

WangChi at 2007-8-31 > top of Msdn Tech,Windows Forms,Windows Forms General...
# 6
Check this thread (not the post marked as the answer, below it)...
nobugz at 2007-8-31 > top of Msdn Tech,Windows Forms,Windows Forms General...