📄 uicreater.cs
字号:
using System;
using System.Xml;
using System.Reflection;
using System.Diagnostics;
using System.ComponentModel;
using System.Collections;
using System.Windows.Forms;
namespace gowk.GXF
{
/// <summary>
/// UICreater 的摘要说明。
/// </summary>
public class UICreater
{
private XmlDocument doc;
public UICreater(string file)
{
try
{
this.doc=new XmlDocument();
doc.Load(file);
this.XmlDocument=doc;
}
catch(System.Exception ex)
{
MessageBox.Show(ex.Message);
throw;
}
}
public Form CreateForm(string id)
{
Form f=null;
XmlNode node=doc.SelectSingleNode(@"descendant::*[@id='"+id+"']");
if(node!=null && node.NodeType==XmlNodeType.Element)
{
try
{
object o=ObjectCreator.Instance.CreateInstance(node);
f=(Form)o;
}
catch
{
throw;
}
}
return f;
}
public object CreateObject(string id)
{
XmlNode node=doc.SelectSingleNode(@"descendant::*[@id='"+id+"']");
if(node!=null && node.NodeType==XmlNodeType.Element)
{
try
{
return ObjectCreator.Instance.CreateInstance(node);
}
catch
{
throw;
}
}
return null;
}
public XmlDocument XmlDocument
{
get{return this.XmlDocument;}
set
{
this.doc=value;
ObjectCreator.Instance.XmlDocument=doc;
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -