Converts a string to the system. Drawing. color type.

Source: Internet
Author: User

1. color. fromargb (120,243,244,247)
First, convert F3, F4, And F7 to the decimal number, and then call the above method.
2. Convert F3 F4 F7 to 10 hexadecimal
Use color. fromargb
3. Color yourcolor = color. fromname ("# f3f4f7 ");
4. A stupid method:
String A = "# f3f4f7 ";
New system. Drawing. color. fromargb (
System. int8.parse (A. substring (1, 2), system. Globalization. numberstyles. allowhexspecifier );
System. int8.parse (A. substring (3,2), system. Globalization. numberstyles. allowhexspecifier );
System. int8.parse (A. substring (5, 2), system. Globalization. numberstyles. allowhexspecifier );
);
5. color = color. fromargb (0xf3, 0xf4, 0xf7 );
6. Public forecolor as system. Drawing. Color = colortranslator. fromhtml ("# f3f4f7 ")
7. system. Drawing. colorconverter cc = new system. Drawing. colorconverter ();
Return (system. Drawing. Color) CC. convertfromstring (shex );

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.