C# DataGridView 常用操作
来源:互联网 发布:在线视频网站cms 编辑:程序博客网 时间:2024/05/16 09:47
DataGridView左侧显示行号方法
DataGridView的RowPostPaint事件
private void planDataGridView_RowPostPaint(object sender, DataGridViewRowPostPaintEventArgs e) { System.Drawing.Rectangle rectangle = new System.Drawing.Rectangle(e.RowBounds.Location.X, e.RowBounds.Location.Y, PlanDataGridView.RowHeadersWidth - 4, e.RowBounds.Height); TextRenderer.DrawText(e.Graphics, (e.RowIndex + 1).ToString(), PlanDataGridView.RowHeadersDefaultCellStyle.Font, rectangle, PlanDataGridView.RowHeadersDefaultCellStyle.ForeColor, TextFormatFlags.VerticalCenter | TextFormatFlags.Right); }
设置DataGridView默认不选中单元格或行
窗口载入事件,否则不起作用
private void MainForm_Load(object sender, EventArgs e) { ///窗口加载时默认不选中单元格 PlanDataGridView.ClearSelection(); // or PlanDataGridView.CurrentCell = null; }
DataGridView单击一个单元格选择一行
this.dataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect;//设置为整行被选中
0 0
- C# DataGridView 常用操作
- C# DatagridView常用操作简介
- C# DatagridView常用操作简介
- C#中对DatagridView部分常用操作
- C#中对DatagridView部分常用操作
- C#中对DatagridView部分常用操作
- C#中对DatagridView部分常用操作
- C#中对DatagridView部分常用操作
- C#中对DatagridView部分常用操作
- C#中对DatagridView部分常用操作
- C#中对DatagridView的部分常用操作
- C#中对DatagridView的部分常用操作
- C#中对DatagridView的部分常用操作
- C#中对DatagridView的部分常用操作
- .Net基础:C#中对DatagridView部分常用操作
- C#中对DatagridView的部分常用操作
- C#中对DatagridView的部分常用操作
- C# datagridview 常用设置
- Java String对象的经典问题(new String())
- Hadoop 2.4.0完全分布式平台搭建、配置、安装
- lost connection to mysql server during query
- 转(Android 4.4 Kitkat Phone工作流程浅析(四)__RILJ工作流程简析)
- Java开发中常见的危险信号
- C# DataGridView 常用操作
- find: 遗漏“-exec”的参数
- jQuery 重设File域
- fatal error C1083: Cannot open precompiled header file: 'Debug/Hello.pch': No such file or directory
- Feed系统架构资料收集
- Java XML文件解析
- NYOJ17 单调递增最长子序列 【二分法】+【动态规划】
- linux汇编详解
- 转(Android 4.4 Kitkat Phone工作流程浅析(五)__MT(来电)流程分析)