简体   繁体   中英

Other way to apply a color instead of SystemColors in order to avoid color changes when publishing to an older Windows

First of all, sorry about the messy title...

I'll try my best to explain.

So.. I'm currently using for the BackColor property in Designer, the following:

this.BackColor = System.Drawing.SystemColors.Control;

When I publish the application and use in other machine (Older windows... different theme, etc..). The color that was defined before, its not the same.

My question is, is there another way to apply a color to avoid this kind of situation?

Thank you very much!

The problem you are encountering is that you have selected a system color which will change depending on what system you run it on.

If you want to have colors stay the same no matter what system they are run on then you must explicitly set the color yourself.

this.BackColor = System.Drawing.Color.FromArgb(255, 0, 0); //Red

This will ensure the color stays red on any system.

Simply replace the FromArgb parameters with the correct RGB values for the desired color.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM