在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows.Forms; namespace Common { /// <summary> /// DataGridView控件操作 /// </summary> public class CtlDataGridViewOperate { private DataGridView m_dataGridView = null; /// <summary> /// DataGridView控件 /// </summary> public DataGridView refDataGridViewControl { set { m_dataGridView = value; } get { return m_dataGridView; } } /// <summary> /// 构造函数 /// </summary> public CtlDataGridViewOperate() { } private static volatile CtlDataGridViewOperate m_dgvOpera = null; /// <summary> /// 获取DataGridView控件操作类单一实例 /// </summary> /// <returns></returns> public static CtlDataGridViewOperate GetInstance() { if(null == m_dgvOpera) { m_dgvOpera = new CtlDataGridViewOperate(); } return m_dgvOpera; } /// <summary> /// 点击数据网格视图单元格显示对话框 /// </summary> /// <param name="frm">要显示的对话框</param> /// <param name="headerText">列头名称</param> /// <param name="e">数据网格视图单元格事件参数</param> public void ClickCellShowDlg(Form frm, string headerText, DataGridViewCellEventArgs e) { if (e.RowIndex < 0 || e.ColumnIndex < 0) { return; } var clmindx = m_dataGridView.CurrentCell.ColumnIndex; if (m_dataGridView.Columns[clmindx].HeaderText.Trim() == headerText) { var rowCell = m_dataGridView.CurrentCell.Value; if (rowCell != null) { frm.StartPosition = FormStartPosition.CenterScreen; frm.ShowDialog(); } } } } }
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论