如何将控件的BackGround颜色设置为十六进制颜色代码 [英] How to set BackGround color of a control to hexadecimal color code

查看:702
本文介绍了如何将控件的BackGround颜色设置为十六进制颜色代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我正在做一个wpf应用程序,其中我使用c#代码动态创建一些按钮。

我想将它们的背景颜色设置为某些十六进制颜色代码。任何人都可以帮助我...

解决方案

这将始终有效,因为它不包含alpha颜色(BackColor属性不支持):



颜色temp = Color.FromArgb(0xFF00FF);

颜色结果= Color.FromArgb(temp.R,temp.G,temp.B);

hi,
I am doing a wpf application,In which i create some buttons Dynamically using c# code.
I want set their background color to some hexadecimal colourcode.Can anybody help me...

解决方案

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);


这篇关于如何将控件的BackGround颜色设置为十六进制颜色代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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