Label.Background =Color.Transparent does not show as 'Transparent' when it is placed inside a GroupBox in the Designer.

Answered
0
0

Hi,

 

As title, The background color of the Label become white color. As the ForeColor is set to white, I cannot read the text in the Designer.

At run time it render correctly and become ‘Transparent’, only the Designer screen have such problem.

Steps to create this case in the Designer in VS 2015:

Changed the BackColor of the Desktop to Black. Add a GroupBox to it, add some labels to the GroupBox, add some Labels to the Desktop. Set the BackColor of all child controls (included the GroupBox and all the Labels) to Transparent. Set the ForeColor of all Labels to white.

Please refer to the attached “Screen 01.jpg” for details.

 

Thanks and regards,

Felix CHAN

 

Attachment
  • You must to post comments
Best Answer
0
0

Hi Felix,

We cannot render transparencies in the designer. Each control is rendered individually and when the color is transparent it will show the background of the design surface which if the inherited background. Otherwise the designer would have to render all the parents before finally rendering the single control. It can be done, but it’s complicated and we left it out for now.

In addition to that, the GroupBox control always inherits the background of the parent (or uses its own) for the label, otherwise you see the line of the frame going across the label. We couln’t use the <frameset> element because it renders very differently in different browsers and it’s close to impossible to style correctly with css. Other themes (or theme changes) may show the label above the frame, in which case the group box can be fully transparent.

Best,

Luca

  • Felix CHAN
    Hi Luca, I currently change the background color of all Labels to black (and ForeColor to white) using the Designer. And then change the background color back to Transparent inside the OnLoad() method by code. Thanks and regards, Felix CHAN
  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.