// 添加一个新的册对象 // parameters: // strRecPath 记录路径 public int NewEntity(string strRecPath, byte[] timestamp, string strXml, bool ScrollIntoView, bool bAutoSetFocus, out EntityEditControl control, out string strError) { strError = ""; control = new EntityEditControl(); control.DisplayMode = "simple_register"; control.HideSelection = false; control.Width = 120; control.AutoScroll = false; control.AutoSize = true; control.Font = this.Owner.Font; control.BackColor = Color.Transparent; control.Margin = new Padding(8, 8, 8, 8); // control.TableMargin = new Padding(100); control.TablePadding = new Padding(64, 12, 24, 12); // control.ErrorInfo = "测试文字 asdfasdf a asd fa daf a df af asdf asdf adf asdf asdf asf asdf asdf ---- "; if (string.IsNullOrEmpty(strXml) == false) { int nRet = control.SetData(strXml, strRecPath, timestamp, out strError); if (nRet == -1) return -1; } else { control.Initializing = false; // control.Barcode = strItemBarcode; if (string.IsNullOrEmpty(control.RefID) == true) control.RefID = Guid.NewGuid().ToString(); } if (timestamp == null) { control.CreateState = ItemDisplayState.New; control.Changed = true; this.EntitiesChanged = true; // 让外界能感知到含有新册事项 } AddEditEvents(control, true); SetControlColor(control); AddEditControl(control); if (bAutoSetFocus == true) control.Focus(); // 这一句让 Edit Control 部分可见,但不是全部可见 if (ScrollIntoView) this.flowLayoutPanel1.ScrollControlIntoView(control); return 0; }
// 添加一个新的册对象 // parameters: // strRecPath 记录路径 public int NewEntity(string strRecPath, byte[] timestamp, string strXml, bool ScrollIntoView, bool bAutoSetFocus, out EntityEditControl control, out string strError) { strError = ""; #if NO if (this.easyMarcControl1.InvokeRequired) { Delegate_NewEntity d = new Delegate_NewEntity(NewEntity); object[] args = new object[5]; args[0] = strRecPath; args[1] = timestamp; args[2] = strXml; args[3] = ScrollIntoView; args[4] = strError; int result = (int)this.easyMarcControl1.Invoke(d, args); // 取出out参数值 strError = (string)args[4]; return result; } #endif control = new EntityEditControl(); control.DisplayMode = "simple_register"; control.HideSelection = false; control.Width = 120; control.AutoScroll = false; control.AutoSize = true; control.Font = this.Owner.Font; control.BackColor = Color.Transparent; control.Margin = new Padding(8, 8, 8, 8); // control.TableMargin = new Padding(100); control.TablePadding = new Padding(64,12,24,12); // control.ErrorInfo = "测试文字 asdfasdf a asd fa daf a df af asdf asdf adf asdf asdf asf asdf asdf ---- "; if (string.IsNullOrEmpty(strXml) == false) { int nRet = control.SetData(strXml, strRecPath, timestamp, out strError); if (nRet == -1) return -1; } else { control.Initializing = false; // control.Barcode = strItemBarcode; if (string.IsNullOrEmpty(control.RefID) == true) control.RefID = Guid.NewGuid().ToString(); } if (timestamp == null) { control.CreateState = ItemDisplayState.New; control.Changed = true; this.EntitiesChanged = true; // 让外界能感知到含有新册事项 } AddEditEvents(control, true); // ClearBlank(); // control.BackColor = ControlPaint.Dark(this.flowLayoutPanel1.BackColor); SetControlColor(control); #if NO control.BackColor = this.flowLayoutPanel1.BackColor; control.ForeColor = this.flowLayoutPanel1.ForeColor; #endif // this.flowLayoutPanel1.Controls.Add(control); AddEditControl(control); // this.flowLayoutPanel1.PerformLayout(); // this.tableLayoutPanel1.PerformLayout(); // this.AdjustFlowLayoutHeight(); if (bAutoSetFocus == true) control.Focus(); // 这一句让 Edit Control 部分可见,但不是全部可见 if (ScrollIntoView) this.flowLayoutPanel1.ScrollControlIntoView(control); return 0; }