如何将前色设置为禁用单选按钮 [英] How to set fore color to disabled radio button

查看:75
本文介绍了如何将前色设置为禁用单选按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的胜利形式中有很多单选按钮,如果我禁用任何一个单选按钮,它的文字前颜色设置为默认表格颜色。



ex:启用单选按钮颜色为黑色和黑色表单颜色为蓝色,如果禁用其中任何一个单选按钮其字体文字前颜色是晦暗的颜色



我有什么试过:



i试过这段代码



如果没有启用那么

rbtnTransCardwiseOnetime.BackColor = Color.Pink



rbtnTransCardwiseOnetime.ForeColor = Color.FromArgb(169

解决方案

试试这个



  Dim  allRadioButtons()< span class =code-keyword> As  RadioButton =  New  RadioButton(){radioButton1,radioButton2,radioButton3,radioButton4} 
对于 Eac h radio As RadioButton In allRadioButtons
如果 radio.Enabled 那么
radio.ForeColor = System.Drawing.Color.Black
Else
radio.ForeColor = .BackColor
结束 如果

下一步


i have many radio buttons in my win form, if i disabled any one of radio button it text fore color is set to default form color.

ex : enable radio button color is black nd form color is blue, if is disable any one of radio button its font text fore color is deafult color

What I have tried:

i have tried this code

If Not Enabled Then
rbtnTransCardwiseOnetime.BackColor = Color.Pink

rbtnTransCardwiseOnetime.ForeColor = Color.FromArgb(169

解决方案

try this

Dim allRadioButtons() As RadioButton = New RadioButton() {radioButton1, radioButton2, radioButton3, radioButton4}
For Each radio As RadioButton In allRadioButtons
    If radio.Enabled Then
        radio.ForeColor = System.Drawing.Color.Black
    Else
        radio.ForeColor = Me.BackColor
    End If
    
Next


这篇关于如何将前色设置为禁用单选按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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