public FormColumnConfig(FormTable parent, ColumnAttribute value) { InitializeComponent(); Value = value; switch (Value.Type) { case ColumnType.Number: rbNumber.Checked = true; break; case ColumnType.String: rbString.Checked = true; break; case ColumnType.DataPointer: rbDataPointer.Checked = true; break; case ColumnType.Time: rbTime.Checked = true; break; case ColumnType.Weekday: rbWeekday.Checked = true; break; } tbDesc.Text = Value.Desc; cbMinInteger.Checked = Value.MinInteger.Enable; tbMinInteger.Text = Value.MinInteger.Value.ToString(); cbMaxInteger.Checked = Value.MaxInteger.Enable; tbMaxInteger.Text = Value.MaxInteger.Value.ToString(); cbMinLength.Checked = Value.MinLength.Enable; tbMinLength.Text = Value.MinLength.Value.ToString(); cbMaxLength.Checked = Value.MaxLegnth.Enable; tbMaxLength.Text = Value.MaxLegnth.Value.ToString(); int selIndex = 0; FormMain.TableList.ForEach(t => { if (t != parent) { cmbLinkTable.Items.Add(t.Text); if (t == Value.LinkTable) { selIndex = cmbLinkTable.Items.Count - 1; } } }); if (1 < FormMain.TableList.Count) { cmbLinkTable.SelectedIndex = selIndex; } }
private void miNewTable_Click(object sender, EventArgs e) { int idx = Rn.Next() % TableNameList.Count; var table = new FormTable(TableNameList[idx]); TableList.Add(table); table.Show(this); TableNameList.RemoveAt(idx); }
private void FormMain_Load(object sender, EventArgs e) { Loc = Location; if (File.Exists(Define.SaveFileName)) { var load = new TableMgr(); var sr = new StreamReader(Define.SaveFileName); load.Load(sr); sr.Close(); load.Tables.ForEach(t => { var formTable = new FormTable(t); formTable.Show(this); TableList.Add(formTable); }); } }