如何动态更改选项组按钮ForeColor? [英] How to change option group button ForeColor dynamically?

查看:62
本文介绍了如何动态更改选项组按钮ForeColor?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

另一个快速问题是... ...


这是我的按钮代码,我想知道我是否可以做一些不同的事情,所以我没有必要对我的选项组中的每个14个按钮重复相同的代码:

展开 | 选择 | Wrap < span class =codeDivider> | 行号

解决方案

< blockquote>

  1. 更改grpSections选项组中所有ToggleButton的ForeColor:

    展开 | 选择 | Wrap | 行号


    糟糕。发言太快了。似乎将所有变为红色而不考虑是否有错过的问题。测试,稍微回过头来。



    立即工作。将其设置为公共变量:

    展开 | 选择 | Wrap | 行号


    ok。代码正在更新前面的颜色,但似乎从黑色变为红色,部分有未解答的问题,当所有问题都得到解答时,您必须单击每个部分以获得颜色从红色(错过的问题)切换到黑色。所以也许一个组合方法可以解决问题。


    表单级别的私有变量设置如下:

    展开 | 选择 | Wrap | 行号

    Another quick question for ya...

    Here''s my button code, and I want to see if I can do something different so I don''t have to repeat the same code for each of my 14 buttons in my option group:

    Expand|Select|Wrap|Line Numbers

    解决方案

    1. To change the ForeColor of all ToggleButtons within the grpSections Option Group:

      Expand|Select|Wrap|Line Numbers


    Oops. spoke too soon. Seems to change all to red not taking into account if there are missed questions. Testing, be back in a bit with more.


    Working now. Set this as a public variable:

    Expand|Select|Wrap|Line Numbers


    ok. Code is updating the fore color but it seems to change from black to red with sections that have unanswered questions and when all the questions are answered you have to click back through each section to get the color to switch from red (missed questions) to black. So maybe a combo approach will do the trick.

    Private variable at form level set as such:

    Expand|Select|Wrap|Line Numbers


    这篇关于如何动态更改选项组按钮ForeColor?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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