在Windows窗体中分组没有组框或面板的单选按钮 [英] Grouping of radio buttons without groupbox or panel in windows forms

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

问题描述





我在C#中使用动态控件创建一个Windows窗体(例如: - 文本框,标签,按钮......)。我想在表单中添加一组单选按钮并将它们分组。但我不喜欢使用面板或组合框来对它们进行分组。有没有办法做到这一点?请指教。



感谢您的帮助,

Kushan Randima。

软件工程师

解决方案

我认为最简单的方法是使用Control.Tag属性。标签是对象类型的属性,因此您可以放置​​任何您想要的东西。但是这样做,你必须订阅动态创建的RadioButton的OnClick事件来处理组内的选择。



和链接:

http://msdn.microsoft.com/en- us / library / system.windows.forms.control.tag%28v = vs.110%29.aspx [ ^ ]



我希望它可以帮助你。


我们不能将特定的单选按钮分组,而不需要在Windows窗体中使用groupbox或panel任何其他容器(c#)


< blockquote>你可以在windows窗体上使用表格控件


Hi,

I am creating a windows form in C# with dynamic controls (Ex:- Textboxes, Labels, Buttons...). I want to add set of radio buttons in to the form and group them. But I don't like to use panels or group boxes for grouping them. Is there a way to do that? Please advice.

Thanks for helping,
Kushan Randima.
Software Engineer

解决方案

I think that simplest way to do this is to use Control.Tag property. Tag is property of Object type, so you can put there anything you want. But doing this, you must subscribe to dynamically created RadioButton's OnClick event to handle selection within groups.

And link:
http://msdn.microsoft.com/en-us/library/system.windows.forms.control.tag%28v=vs.110%29.aspx[^]

I hope it help you.


We can not group specific radio buttons without having groupbox or panel any other container in windows forms (c#)


you can use table control on windows form


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

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