/// <summary> /// 新增按钮,调用创建窗体的结构块创建结构 传递给创建窗体 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void 新增ToolStripMenuItem_Click(object sender, EventArgs e) { CreateClientTypeForm.formType ft = new CreateClientTypeForm.formType(); ft.formStatic = "增"; ft.formText = "增加类别"; ft.richTextbox = ""; ft.textboxName = ""; CreateClientTypeForm cltf = new CreateClientTypeForm(ft); cltf.StartPosition = FormStartPosition.CenterParent; cltf.ShowDialog(this); }
/// <summary> /// 编辑按钮 获取用户选定的行 若行大于0则创建实体传递给创建窗体 填充创建窗体的 /// 文本编辑控件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void 编辑ToolStripMenuItem_Click(object sender, EventArgs e) { if (superGridControl1.PrimaryGrid.GetSelectedRows() != null) { SelectedElementCollection col = superGridControl1.PrimaryGrid.GetSelectedRows(); if (col.Count > 0) { GridRow row = col[0] as GridRow; CreateClientTypeForm.formType ft = new CreateClientTypeForm.formType(); ft.formStatic = "改"; ft.formText = "修改类别"; ft.richTextbox = row.Cells[2].Value == null ? "" : row.Cells[2].Value.ToString(); ft.textboxName = row.Cells[3].Value == null ? "" : row.Cells[3].Value.ToString(); CreateClientTypeForm cltf = new CreateClientTypeForm(ft); cltf.ShowDialog(); if (refresh) { loadData(); refresh = false; } } else { MessageBox.Show("请先选中要修改的数据所在行"); } } else { MessageBox.Show("请先选中要修改的数据所在行"); } }