public Item AppendNewItem(bool bSetDefaultRecord) { this.DisableUpdate(); // 防止闪动。彻底解决问题。2009/10/13 try { this.tableLayoutPanel_content.RowCount += 1; this.tableLayoutPanel_content.RowStyles.Add(new System.Windows.Forms.RowStyle()); Item item = new Item(this); item.AddToTable(this.tableLayoutPanel_content, this.Items.Count + 1); this.Items.Add(item); if (this.GetDefaultRecord != null && bSetDefaultRecord == true) { GetDefaultRecordEventArgs e = new GetDefaultRecordEventArgs(); this.GetDefaultRecord(this, e); string strDefaultRecord = e.Xml; if (String.IsNullOrEmpty(strDefaultRecord) == true) goto END1; string strError = ""; // 根据缺省XML订购记录填充必要的字段 int nRet = SetDefaultRecord(item, strDefaultRecord, true, out strError); if (nRet == -1) throw new Exception(strError); } END1: item.State = ItemState.New; return item; } finally { this.EnableUpdate(); } }
Item AppendNewItem(ItemType itemType) { this.DisableUpdate(); // 防止闪动。彻底解决问题。2009/10/13 try { this.tableLayoutPanel_content.RowCount += 1; this.tableLayoutPanel_content.RowStyles.Add(new System.Windows.Forms.RowStyle()); Item item = new Item(this, itemType); item.AddToTable(this.tableLayoutPanel_content, this.Items.Count + 1); this.Items.Add(item); return item; } finally { this.EnableUpdate(); } }