在运行时将颜色关联到按钮控件 [英] Assinging color to button control at run time

查看:46
本文介绍了在运行时将颜色关联到按钮控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在运行时创建按钮,并且我具有此(19,117,36)格式的颜色值,如何使用该整数值来辅助颜色.
例子
btn1.BackColor = 19,117,36

告诉我plz ..

i am creating button at run time, and i have a color value in this(19,117,36) format, how i can use this integer value to assing color.
example
btn1.BackColor=19,117,36

tell me plz..

推荐答案

这很容易.试试这个

This is Pretty easy enough. Try with this

btn1.BackColor = Color.LightGreen;



如果您想使用整数值,则应使用



And if u want to use integer value then you should use

Color.FromArgb(19,117,36)


,您可以使用整数值使用以下代码来分配颜色.
使用RGB颜色格式.

you can use Integer values to assign color use following code.
use RGB color format.

btn1.BackColor = System.Drawing.Color.FromArgb(19,117,36)


您还需要为名称空间System.Drawing
You also need to add using statement for namespace System.Drawing


这篇关于在运行时将颜色关联到按钮控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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