可以使用以下代码来找出 WinForms 中所有的 Button 控件:

using System.Linq;
using System.Windows.Forms;

IEnumerable<Button> buttons = this.Controls.OfType<Button>();

以上代码将会返回一个 'IEnumerable


原文地址: https://www.cveoy.top/t/topic/oDrJ 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录