Set the Web server control color attribute to convert

Source: Internet
Author: User
Transferred from MSDN

To set a Web server control property (such as the BackColor property) to a Color, you need to assign a reference to the Color object.

Set the Web Server Control property to a color

  • Call the FromArgb method of the Color object, pass the value (RGB) to it, or call FromName to pass the Color name as a string to it. Alternatively, you can use a static method that references a predefined color name to assign a color, as shown in the following example:

Button1.BackColor = System. Drawing. Color. FromName ("Red ");
// White in RGB.
Button1.BackColor = System. Drawing. Color. FromArgb (255,255,255 );
Button1.BackColor = System. Drawing. Color. Red;
// HTML 4.0 color.
Button1.BackColor = System. Drawing. Color. MediumSeaGreen;

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.