zoukankan
html css js c++ java
Winform处理MDI父窗体与子窗体的交互
设置个窗体只能弹出一次
设置个窗体只能弹出一次
#region
设置个窗体只能弹出一次
/**/
/**/
/**/
///
<summary>
///
控制只弹出一个子窗体
///
</summary>
///
<param name="type">
子窗体类型
</param>
public
void
FilmShow(Type type)
{
Form[] f
=
this
.MdiChildren;
foreach
(Form form
in
f)
{
if
(form.GetType().Name
==
type.Name)
{
form.Activate();
return
;
}
}
Assembly a
=
Assembly.GetExecutingAssembly();
Form ff
=
(Form)a.CreateInstance(type.FullName);
ff.MdiParent
=
this
;
ff.Show();
//
this.statusBarPanel3.Text = this.ActiveMdiChild.Text.ToString();
}
/**/
/**/
/**/
///
<summary>
///
该窗体以模式窗体形式弹出
///
</summary>
///
<param name="type"></param>
public
void
FilmShowDialog(Type type)
{
Form[] f
=
this
.MdiChildren;
foreach
(Form form
in
f)
{
if
(form.GetType().Name
==
type.Name)
{
form.Activate();
return
;
}
}
Assembly a
=
Assembly.GetExecutingAssembly();
Form ff
=
(Form)a.CreateInstance(type.FullName);
ff.ShowDialog();
//
this.statusBarPanel3.Text = this.ActiveMdiChild.Text.ToString();
}
#endregion
下面是如果调用该方法
private
void
menuItem2_Click(
object
sender, System.EventArgs e)
{
//
密码修改,弹出模式窗体
this
.FilmShowDialog(
typeof
(AdminPwdUpdate));
}
private
void
menuItem4_Click(
object
sender, System.EventArgs e)
{
//
类别管理,弹出子窗体
this
.FilmShow(
typeof
(TypeForm));
}
,
这个送给你!
查看全文
相关阅读:
memcached 细究(一)
centos文件/文件夹操作-检查磁盘、内存、cpu使用情况-vi操作命令
判断php变量是否定义,是否为空,是否为真的一览表
php 在函数前面加个@的作用
apache Header set Cache-Control
windows上memecache添加多个端口命令
Android 4.4KitKat AudioFlinger 流程分析
Android 4.4KitKat Sound System
Android 4.4KitKat AudioTrack 流程分析
Android Shell Cmd
原文地址:https://www.cnblogs.com/di305449473/p/1245779.html
最新文章
Go-cron定时任务
Linux的crond和crontab
xxx is not in the sudoers file.This incident will be reported.的解决方法
Go类型别名与类型定义区别
Go-TCP粘包
博客园文章排版美化---增加返回顶部按钮
virtualenv使用和virtualenvwrapper使用笔记
MySQL查询某个数据库某个表的字段
idea导入项目
将GitLab上面的代码克隆到本地
热门文章
Windows忘记mysql的密码
CentOS 升级 openSSH+ sh脚本自动运维
实战:liunx定时清理日志脚本
FXP登录Linux报错
MySQL定时调用存储过程
MySQL定时调用存储过程(事件的使用)
在线聊天优化,遇到的问题
mysql数据库操作
memcached 细究(三)
memcached 细究(二)
Copyright © 2011-2022 走看看