private void m_buttonCopyAs_Click(object sender, EventArgs e) { if (m_listBoxLayout.SelectedIndex < 0) { return; } try { int LayoutIdx = m_listBoxLayout.SelectedIndex; if (LayoutIdx < 0) { return; } LayoutSettingClass Layout = m_LayoutSettingList.Items[LayoutIdx]; if (Layout.Name != "") { List <string> ExistLayout = new List <string>(); foreach (LayoutSettingClass item in m_LayoutSettingList.Items) { ExistLayout.Add(item.Name); } CommonEditForm Form = new CommonEditForm(ExistLayout); Form.Text = ResString.GetResString("Add_Layout"); if (DialogResult.OK == Form.ShowDialog()) { LayoutSettingClass newItem = new LayoutSettingClass(); newItem.Layout = Layout.Layout.Clone(); newItem.SpecialLayout = Layout.SpecialLayout; newItem.SpecialYSpace = Layout.SpecialYSpace; newItem.Name = Form.Input; m_LayoutSettingList.Items.Add(newItem); Bind(); m_listBoxLayout.SelectedIndex = m_listBoxLayout.Items.Count - 1; } } } catch (Exception ex) { MessageBox.Show("Failed to copy layout:" + ex.Message); } }
private void m_buttonAddMode_Click(object sender, EventArgs e) { List <string> ExistLayout = new List <string>(); foreach (LayoutSettingClass Layout in m_LayoutSettingList.Items) { ExistLayout.Add(Layout.Name); } CommonEditForm Form = new CommonEditForm(ExistLayout); Form.Text = ResString.GetResString("Add_Layout"); if (DialogResult.OK == Form.ShowDialog()) { LayoutSettingClass layout = new LayoutSettingClass(); layout.Name = Form.Input; m_LayoutSettingList.Items.Add(layout); Bind(); m_listBoxLayout.SelectedIndex = m_listBoxLayout.Items.Count - 1; } }