private FormInfo()
{
InitializeComponent();
}
private static FormInfo instance;
public static FormInfo CreateFrom(string caption,string[] info)
{
//判断是否存在该窗体,或时候该字窗体是否被释放过,如果不存在该窗体,则 new 一个字窗体
if (instance == null || instance.IsDisposed)
{
instance = new FormInfo();
}
instance.Text = caption;
instance.listBoxT.Items.Clear();
instance.listBoxT.Items.AddRange(info);
return instance;
{
InitializeComponent();
}
private static FormInfo instance;
public static FormInfo CreateFrom(string caption,string[] info)
{
//判断是否存在该窗体,或时候该字窗体是否被释放过,如果不存在该窗体,则 new 一个字窗体
if (instance == null || instance.IsDisposed)
{
instance = new FormInfo();
}
instance.Text = caption;
instance.listBoxT.Items.Clear();
instance.listBoxT.Items.AddRange(info);
return instance;
}
调用方法:
FormInfo fi = FormInfo.CreateFrom("检查错误信息", listAll.ToArray());
Autodesk.AutoCAD.ApplicationServices.Application.ShowModelessDialog(fi);
该博客介绍了如何在C#中开发CAD应用,重点在于如何只初始化窗口一次并在后续操作中修改窗口内的数据。示例代码展示了通过调用FormInfo和Autodesk.AutoCAD库的方法来实现模式对话框的显示,动态更新检查错误信息。

被折叠的 条评论
为什么被折叠?



