C # The background color of the label control is Transparent.

Source: Internet
Author: User

C # The background color of the label control is Transparent.

C # The background color of the label control is changed to Transparent or Transparent. The label control is followed by picturebox. You need to set it first and then add it to the parent control. If it has already been added to the parent control, if it is set to transparent, it is invalid.

Label1.Parent = Picturebox1
Label1.BackColor = Color. Transparent

Label1.Parent = Picturebox1
This statement can be written in the code. It cannot be implemented during design ....


The control does not have a parent by default, especially when it is easy for new users who use IDE to fall into the trap. Dragging a widget into the form will not help you set parent.

Another trap is probably written as canvas1.Parent = this. Because this is a form, and the default background color of the form is gray, the background color of the control is gray in this way, it looks like it has no effect, but if you change the form to blue, the background color of the control is blue. If a newbie cannot figure out the framework structure of the form

Canvas1.Parent = pictureBox1;
Canvas1.BackColor = Color. Transparent;
Canvas1.CanvasImage = new Bitmap ("");

PS tutorial. At last, we found that canvas1.BackColor = Color. Transparent is not required. The default

Canvas1.Parent = pictureBox1;
Canvas1.CanvasImage = new Bitmap ("");

In addition, parent is the father, Transparent is the color set by the parent control, it's that simple

Almost all people on the Internet use this method BackColor = Color. Transparent, which is always unsuccessful at the beginning.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.