winform子窗体控制父窗体控件
2016-03-09 17:59
375 查看
在Progam类中定义static的父窗体引用,这样在所有的子窗体中都可以使用该引用来操作父窗体
比如:
public static MainForm mainForm;
public static Main()
{
.......
mainForm=new MainForm();
Appliection.Run(mainForm);
}
调用
foreach (Control ct in Program.mainForm.Controls)
{
if (ct is RibbonControl)
{
RibbonControl cd = ct as RibbonControl;
cd.Enabled = false;
}
}
比如:
public static MainForm mainForm;
public static Main()
{
.......
mainForm=new MainForm();
Appliection.Run(mainForm);
}
调用
foreach (Control ct in Program.mainForm.Controls)
{
if (ct is RibbonControl)
{
RibbonControl cd = ct as RibbonControl;
cd.Enabled = false;
}
}
相关文章推荐
- 选项卡制作问题--折磨了我一整天,记录下来
- Epic Games王祢:UE4在移动平台的开发优势
- Android Studio 工作中用快捷键
- web中父页面与子页面传值的问题
- Effective STL 第一章:容器(四)
- Symmetric Tree
- JNDI配置
- 148.View the Exhibit and examine the structure of the PRODUCTS tables.
- [转]backbone.js 初探
- nginx重启
- 从相册或者相机获得uri转为bitmap
- jedis调用redis之事物
- Tomcat配置虚拟主机的方法
- Chapter 4. Button, Checkbutton, and Radiobutton Widgets 按钮,复选按钮,单选按钮
- A + B + C Problem
- cell的自适应
- rtc关机闹钟5 AlarmManager研究
- Chapter 4. Button, Checkbutton, and Radiobutton Widgets 按钮,复选按钮,单选按钮
- Chapter 4. Button, Checkbutton, and Radiobutton Widgets 按钮,复选按钮,单选按钮
- 比赛用的框架代码