c#中Windows窗体中的所有按钮 [英] All Buttons in a Windows Form in c#

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

问题描述

我正在使用c#2010进行Windows窗体开发。

我有一个窗体,里面有多个容器,里面装满了很多按钮。

我想改变FlatAppearance。加载表单时所有按钮的FlatStyle属性。

请注意从数据库中获取属性FlatStyle的值。



希望有人可以帮助我。

提前致谢。

Jim

I am using c# 2010 for windows forms development.
I have a form having multiple containers in it and filled with many buttons.
I want to change FlatAppearance.FlatStyle property of all buttons while loading the form.
please also note that the value of the property FlatStyle to be taken from a database.

Hope someone can help me.
Thanks in advance.
Jim

推荐答案

检查: http://stackoverflow.com/questions/3419159/how-to-get-all-child-controls-of-a-windows-forms-form-of-a-specific-type-button#answer-3426721 [ ^ ]



给出的示例是返回文本框,但当然您可以使用它来获取所有按钮。只需迭代并更改该属性 - 它的值是否来自数据库无关紧要。
Check this: http://stackoverflow.com/questions/3419159/how-to-get-all-child-controls-of-a-windows-forms-form-of-a-specific-type-button#answer-3426721[^]

The sample given is returning textboxes, but of course you can use it to get all buttons instead. Simply iterate and change that property - it is irrelevant whether it's value is coming from a database or not.


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

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