private void listBox2_SelectedIndexChanged(object sender, EventArgs e) { if (this.listBox2.SelectedItem == null) { return; } string[] array = this.listBox2.SelectedItem.ToString().Split(SysConstManage.Point); string tbnm = array[0]; string fldnm = array[1]; var table = _tableStructs.FirstOrDefault(i => i.Name == tbnm); if (table != null) { var o = _relateFields.FirstOrDefault(i => i.FromTableIndex == table.TableIndex && i.FieldNm == fldnm); if (o != null) { RelateFieldProperty property = (RelateFieldProperty)this.splitContainer1.Panel2.Controls[o.ID]; //var exist= _rfieldPropertylist.FirstOrDefault(i => i.Name == o.ID); if (property == null) { property = new RelateFieldProperty(o.ID); property.Dock = DockStyle.Fill; property.SetPropertyValue(o, null); _rfieldPropertylist.Add(property); this.splitContainer1.Panel2.Controls.Add(property); } ModelDesignProject.SetControlVisible((Control)property, this.splitContainer1.Panel2.Controls); } } }
public FromSourceControl(LibFromSourceField[] sourceFields) : this() { foreach (LibFromSourceField item in sourceFields) { this.listBox1.Items.Add(item); FromSourceProperty sourceProperty = new FromSourceProperty(item.ID); sourceProperty.Dock = DockStyle.Fill; this.splitContainer1.Panel2.Controls.Add(sourceProperty); sourceProperty.SetPropertyValue(item, null); ModelDesignProject.SetControlVisible(sourceProperty, this.splitContainer1.Panel2.Controls); } }
private void ListBox1_SelectedIndexChanged(object sender, EventArgs e) { ListBox box = sender as ListBox; LibFromSourceField selectfield = box.SelectedItem as LibFromSourceField; foreach (Control item in this.splitContainer1.Panel2.Controls) { if (item.Name == selectfield.ID) { ModelDesignProject.SetControlVisible(item, this.splitContainer1.Panel2.Controls); break; } } }
/// <summary> /// 新增按钮点击事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Button1_Click(object sender, EventArgs e) { LibFromSourceField fromSourceField = new LibFromSourceField(); fromSourceField.ID = Guid.NewGuid().ToString(); this.listBox1.Items.Add(fromSourceField); FromSourceProperty sourceProperty = new FromSourceProperty(fromSourceField.ID); sourceProperty.Dock = DockStyle.Fill; this.splitContainer1.Panel2.Controls.Add(sourceProperty); sourceProperty.SetPropertyValue(fromSourceField, null); ModelDesignProject.SetControlVisible(sourceProperty, this.splitContainer1.Panel2.Controls); //SetPanel2ControlsVisible(sourceProperty); }