Background code in WPF changes the font or background color

Source: Internet
Author: User

A memo. Once write code to change the background color and then suddenly can't remember, now record down, later standby.


This.lbl.Foreground = new SolidColorBrush (Color.FromArgb (255, 255, 0, 0));
This.lbl.Foreground = new SolidColorBrush (Color) colorconverter.convertfromstring ("#f0f00f");

This.lbl.Foreground = new SolidColorBrush (Color.fromrgb (255,255,255));


The first is to use the ARGB format, and the second is to use hexadecimal format, which is very common in WPF, and is recommended for use. The third is the use of RGB code, RGB to hexadecimal online there are many small programs, conversion is quite convenient.

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.