public export2ExcelFrm() { InitializeComponent(); mCadReader = null; ReadLayer(); ReadCfgFile(); this.compareCmb.ItemHeight = 19; this.typeCmb.ItemHeight = 19; this.compareCmb.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawVariable; this.typeCmb.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawVariable; this.compareCmb.DrawItem += new System.Windows.Forms.DrawItemEventHandler(this.compareCmb_DrawItem); this.typeCmb.DrawItem += new System.Windows.Forms.DrawItemEventHandler(this.typeCmb_DrawItem); }
/// <summary> /// 读取实体对照表的数据 /// </summary> private void InitCompare(string strComName) { if (null == mCadReader) { mCadReader = new CxCadReader(); } mCadReader.ClearCompare(); if (strComName == "") { return; } XmlDocument xmlDoc = new XmlDocument(); try { xmlDoc.Load(strComName); } catch (Exception ex) { MessageBox.Show(ex.Message, "读取错误", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } // 使用xpath表达式选择block对照信息存放在Hash中 XmlNodeList blockNodes = xmlDoc.SelectNodes("//blocks/block"); if (null != blockNodes) { foreach (XmlNode blockNode in blockNodes) { mCadReader.AddCompare(blockNode.Attributes["id"].Value, blockNode.Attributes["name"].Value); } } }