private void btnAdd_Click(object sender, EventArgs e) { try { if (_OperateType.Equals("区域")) { FrmAddArea frmAddArea = new FrmAddArea(); FrmExample frmExample = new FrmExample() { Size = new System.Drawing.Size(frmAddArea.Size.Width, frmAddArea.Size.Height) }; frmExample.Controls.Add(frmAddArea); frmExample.ShowDialog(); } else if (_OperateType.Equals("屏幕")) { FrmSreenToArea frmSreen = new FrmSreenToArea(null); FrmExample frmExample = new FrmExample() { Size = new System.Drawing.Size(frmSreen.Size.Width, frmSreen.Size.Height) }; frmExample.Controls.Add(frmSreen); frmExample.ShowDialog(); } btnSearch_Click(null, null); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private void btnModify_Click(object sender, EventArgs e) { try { if (dgvContent.CurrentRow != null) { if (_OperateType.Equals("区域")) { AreaInfo areaInfo = new AreaInfo(); areaInfo.AreaName = dgvContent.CurrentRow.Cells["AreaName"].Value.ToString(); areaInfo.AreaId = Convert.ToInt32(dgvContent.CurrentRow.Cells["AreaId"].Value); FrmAddArea frmAddArea = new FrmAddArea(areaInfo); FrmExample frmExample = new FrmExample() { Size = new System.Drawing.Size(frmAddArea.Size.Width, frmAddArea.Size.Height) }; frmExample.Controls.Add(frmAddArea); frmExample.ShowDialog(); } else if (_OperateType.Equals("屏幕")) { ScreensToArea screens = new ScreensToArea(); screens.ID = Convert.ToInt32(dgvContent.CurrentRow.Cells["ID"].Value); screens.ScreenID = dgvContent.CurrentRow.Cells["ScreenID"].Value.ToString(); screens.AreaID = Convert.ToInt32(dgvContent.CurrentRow.Cells["AreaID"].Value); FrmSreenToArea frmSreen = new FrmSreenToArea(screens); FrmExample frmExample = new FrmExample() { Size = new System.Drawing.Size(frmSreen.Size.Width, frmSreen.Size.Height) }; frmExample.Controls.Add(frmSreen); frmExample.ShowDialog(); } } else { MessageBox.Show("请选中修改!"); } btnSearch_Click(null, null); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }