日期:2014-05-17 浏览次数:20846 次
public delegate void WeiTuo<XmlNode>(XmlNode s ); //定义委托
private WeiTuo<XmlNode> weituo; //定义委托
private void frmMain_Load(object sender, EventArgs e)
{
EQ2008Config.GetSection();
string strpath = AppDomain.CurrentDomain.BaseDirectory + "\\StationConfig.xml";
XmlDocument doc = new XmlDocument();//初始化一个xml实例
doc.Load(strpath);//导入指定的xml文件
XmlNode no = doc.SelectSingleNode("StationList");//指定一个节点
XmlNodeList listnode = no.SelectNodes("StationData");//获取同名同级别"stationdata"节点集合
ti = new TimerCallback(ShowDataToScreenStation);
//System.Windows.Forms.Control.CheckForIllegalCrossThreadCalls = false;
foreach (XmlNode node in listnode)//遍历所有的stationdata节点
{
weituo = new WeiTuo<XmlNode>(Set_labelText);
StartThread(node);
}
}
public void Set_labelText(XmlNode strText)
{
StationData stationData = new StationData(strText);
//stationData.IsShow = false;
Program.listStationList.Add(stationData);
this.flowLayoutPanel1.BackColor = Color.Orange;
Label lab = new Label();//实例一个label显示
lab.Name = "lab" + stationData.CardFlagID.ToString();
lab.AutoSize = false;
lab.Size = new Size(280, 140);
lab.BorderStyle = BorderStyle.Fixed3D;
lab.Text = stationData.StatinName;
lab.Font = new Font("宋体", 11)