C#winform datagridview如何自定义列头
来源:互联网 发布:cs4是什么软件 编辑:程序博客网 时间:2024/04/30 02:43
示例代码:
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Text;
- using System.Windows.Forms;
- namespace WindowsApplication6
- {
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- }
- private void button1_Click(object sender, EventArgs e)
- {
- DataTable table = new DataTable();
- DataColumn c1 = new DataColumn("ID", typeof(int));
- table.Columns.Add(c1);
- DataColumn c2 = new DataColumn("name", typeof(string));
- table.Columns.Add(c2);
- DataRow r1 = table.NewRow();
- r1["ID"] = 1;
- r1["name"] = "abc";
- table.Rows.Add(r1);
- DataRow r2 = table.NewRow();
- r2["ID"] = 2;
- r2["name"] = "bcd";
- table.Rows.Add(r2);
- this.dataGridView1.DataSource = table;
- }
- //改变HeaderText
- private void button2_Click(object sender, EventArgs e)
- {
- this.dataGridView1.Columns["ID"].HeaderText = "第一列";
- this.dataGridView1.Columns["name"].HeaderText = "第而列";
- }
- }
- }
- C#winform datagridview如何自定义列头
- winform datagridview加自定义列
- 如何设计WinForm中DataGridView控件的自定义按钮列
- [WinForm]DataGridView列头右键菜单
- winform中DataGridView自定义列排序
- C#:winform DataGridview 自动调整列宽
- C#:winform DataGridview 自动调整列宽
- 【分享】如何设计WinForm中DataGridView控件的自定义按钮列
- c#——Winform DatagridView 扩展支持combobox列自定义DropDownStyle
- C#Winform中如何给DataGridView添加一个自增列
- c# winform 用代码修改DataGridView列头的名字,设置列名,修改列名
- Winform中DataGridView绑定List<T>数据源时,点击DataGridView列头不能自动排序解决方法
- DataGridView列头checkbox
- WinForm:如何设置DataGridView列标题对齐方式
- C#Winform判断DataGridView中的checkbox列是否选中
- [C#] winform中的DataGridView的列宽设置,添加序号
- Winform DataGridView 自定义分页
- winform datagridview 手动绑定列
- MM 模块主要 T-CODE 和主要使用的表
- MIDP(http://baike.baidu.com/view/50372.htm)
- 关于Javascript 的 prototype问题
- FxCop1.36之二:规则的追加翻译
- mysql导入sql文件:Mysql导入导出.sql文件
- C#winform datagridview如何自定义列头
- SSCI收录的管理类期刊
- ABAP 打开文件
- HASH表解决冲突———双链表循环使用
- ssh no password login summary
- 常用的系統變數
- SQL Injection(SQL注入)介绍及SQL Injection攻击检测工具
- 事务
- 酷BI了,我的UBUNTU桌面--- MAC系统的复制版