使用单选按钮作为复选框 [英] Using radio buttons as check boxes

查看:94
本文介绍了使用单选按钮作为复选框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我想在表单中设置一组单选按钮,以便自由选择多个单选按钮。我知道我们可以使用GroupBox和Panel等容器实现这一目标。但我被要求在不使用这些容器的情况下这样做。它基本上似乎提供了复选框到收音机按钮的功能。



在此先感谢。

Ankit

Hi,

I want a set of radio buttons in a form so as to provide the liberty to select more than one radio button. I know we can achieve this using containers like GroupBox and Panel. But I have been asked to do this without using those containers. Its basically seem to provide the functionality of Check Box to Radio Buttons.

Thanks in Advance.
Ankit

推荐答案

永远不要尝试这样做。首先,它会极大地混淆用户。



(顺便说一下,我发现技术上很可能。只是一个有趣的逻辑思维练习。任何知道单选按钮如何工作的人,甚至不是编程水平,都应该能够找到诀窍。这是一个暗示。但是,请你自己一个大忙,甚至不要关于为真正的应用程序做这件事。)
祝你好运,

-SA
Never attempt to do it. First of all, it will enormously confuse the users.

(By the way, I just found that it''s technically quite possible. Just a funny exercise in logical thinking. Anyone who knows how radio buttons work, not even on programming level, should be able to find out the trick. This is a hint. But please, do yourself a big favor, don''t even thing about doing it for a real application.)
Good luck,
—SA


你好。如果你使用WPF,你可以使用ControlTemplate像这样:

Hi.if you working with WPF you can use ControlTemplate Like this:
<RadioButton Content="MyRadioButton" Height="15">
            <RadioButton.Template>
                <ControlTemplate TargetType="{x:Type RadioButton}">
                    <CheckBox Content="{TemplateBinding Content}"/>
                </ControlTemplate>
            </RadioButton.Template>
        </RadioButton>



i认为它不合逻辑,因为每个控件都有自己的域使用权。但选择你自己。

祝你好运


i think it''s not logical because each control has own domain usage.but choose yourself.
Good Luck


这篇关于使用单选按钮作为复选框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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