Windows窗体中的单选按钮 [英] Radio buttons in Windows forms

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

问题描述

Hello Experts,



一个非常快速的问题。如果我在Windows窗体应用程序中有两个单选按钮Rbn1,Rbn2。如果用户首先检查单选按钮Rbn1并改变主意将其检查到Rbn2。可以问用户您确定消息吗?如果是的话,我怎么知道他已经先检查过Rbn1然后再点击Rbn2?

我应该在Rbn2检查更改事件中编写代码吗?但它显示当前Rbn2被检查

我应该知道一些标志吗?





想法/建议非常感谢。



谢谢

Hello Experts,

A very quick question. If I have two radio buttons Rbn1, Rbn2 in windows forms application. And if user first checks the Radio button Rbn1 and changes mind to check it to Rbn2. Can ask user Are you sure message? If yes, how do I know that he already checked Rbn1 first and then clicked on Rbn2?
Should I write code in Rbn2 checked change event ? But it shows current as Rbn2 is checked
Should I make some flag to know ?


Ideas/suggestions are much appreciated.

Thanks

推荐答案

怎么样?通过处理事件 RadioButton.CheckedChanged 事件,当然https://msdn.microsoft.com/en-us/library/system.windows.forms.radiobutton.checkedchanged% 28v = vs.110%29.aspx [ ^ ]。



如何知道之前检查过的内容? 当然,通过在某些内存区域(通常是队列)中记录一些先前的一些控件集合。这就是全部。



现在,请仔细聆听。很难发明更糟糕的UI滥用以及混淆用户的更糟糕的方式。 不,用户不想要您的警告信息,以及任何其他 洗脑 如果用户点击某个单选按钮,那个人就意味着它。如果错误地选择了某些内容,则用户可以看到所选内容。 您正在尝试根据历史记录创建行为,这是不可能的。现在,只需考虑一下:您的应用程序知道该状态,但用户无法看到它。相当不错的规则是: 没有隐藏状态



您可以警告用户错误的选择,只有在最终时。您可以收集所有相关控制的所有状态,并告知用户其中的含义,但仅限于此选择的使用即将变为不可逆转的时刻



-SA
How? By handling the event RadioButton.CheckedChanged event, of course: https://msdn.microsoft.com/en-us/library/system.windows.forms.radiobutton.checkedchanged%28v=vs.110%29.aspx[^].

How to know what was checked before? Of course, by recording some set of previous sets of some controls in some memory area, typically a queue. That's all.

Now, please listen carefully. It's hard to invent worse UI abuse and the worse way to confuse the user. No, the user does not want your warning message, as well as any other brainwash. If the user clicks some radio button, that person means it. If something was selected by mistake, the users can see what is selected. You are trying to create the behavior depending on history, and this is impossibly bad. Now, just think about it: your application "knows" that state, but the user cannot see it. The pretty good rule would be: no hidden states.

You can warn the user of wrong choice, only when it is final. You can collect all the states of all relevant control and inform the user one the implications, but only at the moment of time when the use of this choice is about to become irreversible.

—SA


这篇关于Windows窗体中的单选按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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