十六进制code形式的改变背景颜色 [英] Changing background color of the form with hexadecimal code

查看:126
本文介绍了十六进制code形式的改变背景颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个方法,名为 ChangeFormBackground(颜色colorName)这改变了形式背景,在 colorname 这是method.Now,当我把这个方法我没有色彩的名字,但颜色的十六进制值code和我想用这种方法来改变与十六进制code形式的背景色,该参数我该怎么办?

I have one method named ChangeFormBackground(Color colorName) which changes the form background with the colorname which is the parameter of the method.Now when I call this method I have not color name but the hexadecimal code of the color and I want to change the background color of the form with that hexadecimal code using that method then what should I do?

推荐答案

这会一直工作,因为它不包含字母的颜色(不支持背景色属性):

This will always work because it doesn't contain alpha color (which is not supported by BackColor property):

Color temp = Color.FromArgb(0xFF00FF);
Color result = Color.FromArgb(temp.R, temp.G, temp.B);

这篇关于十六进制code形式的改变背景颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆