【问题标题】:Change the color of the button by using html color codes使用 html 颜色代码更改按钮的颜色
【发布时间】:2017-12-08 18:52:37
【问题描述】:

我想在windows form 应用程序中按下button 时更改它的颜色,并且我想使用颜色代码。有没有办法让button color #C0C0C0 ??

【问题讨论】:

标签: c# html button colors windows-forms-designer


【解决方案1】:

您可以使用 rgb 等价物。#c0c0c0 RGB = 192 192 192 的颜色空间

     button1.ForeColor= Color.FromArgb(192, 192, 192);

【讨论】:

    【解决方案2】:
    This may help you..
    <script>
    function changeCol(btnid){
        document.getElementById(btnid).style.backgroundColor = "#ff00F0";
    }
    </script>
    <input type = "button" id = "btn" value="$alt1" onClick="changeCol('btn')">
    

    【讨论】:

    • 此答案适用于网页设计,而不适用于 Windows 窗体设计
    猜你喜欢
    • 1970-01-01
    • 2011-04-19
    • 2020-08-03
    • 2014-07-11
    • 1970-01-01
    相关资源
    最近更新 更多