1 Star 0 Fork 4

lizongfeng/studentPhotoCollection

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
LoadingForm.cs 1.39 KB
一键复制 编辑 原始数据 按行查看 历史
勒密尔朗 提交于 2020-03-20 23:08 +08:00 . 第一次提交
using System;
using System.Windows.Forms;
namespace StudentPhotoCollection
{
public partial class LoadingForm : Form
{
public LoadingForm()
{
InitializeComponent();
}
public void CloseForm()
{
if (this.InvokeRequired)
{
//这里利用委托进行窗体的操作,避免跨线程调用时抛异常,后面给出具体定义
CONSTANTDEFINE.SetUISomeInfo UIinfo = new CONSTANTDEFINE.SetUISomeInfo(new Action(() =>
{
while (!this.IsHandleCreated)
{
;
}
if (!this.IsDisposed)
{
this.Dispose();
}
this.Close();
}));
this.Invoke(UIinfo);
}
else
{
if (!this.IsDisposed)
{
this.Dispose();
}
this.Close();
}
}
private void LoadingForm_FormClosing(object sender, FormClosingEventArgs e)
{
if (!this.IsDisposed)
{
this.Dispose(true);
}
}
}
//定义一个委托类
class CONSTANTDEFINE
{
public delegate void SetUISomeInfo();
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C#
1
https://gitee.com/pipibaibai/studentPhotoCollection.git
git@gitee.com:pipibaibai/studentPhotoCollection.git
pipibaibai
studentPhotoCollection
studentPhotoCollection
master

搜索帮助