摘要: 1) 列冻结 DataGridViewColumn.Frozen 属性为 True 时, 该列左侧的所有列被固定, 横向滚动时固定列不随滚动条滚动而左右移动。这对于重要列固定显示很有用。 [VB.NET] ' DataGridView1的左侧2列固定 DataGridView1.Columns(1) 阅读全文
posted @ 2019-03-23 20:37 厦门哈韩 阅读(182) 评论(0) 推荐(0)
摘要: private void Form1_Load(object sender, EventArgs e) { string str = "server=192.168.100.222;user=sa;pwd=p@ssw1rd;database=pwd1"; SqlConnection mycon = 阅读全文
posted @ 2019-03-23 20:33 厦门哈韩 阅读(138) 评论(0) 推荐(0)
摘要: 两种方法 第一种 DataGridview1.Rows[i].DefultCellStyle.backcolor 第二种 AlternatingRowsDefutCellstyle 属性 获取或设置应用于DataGridview的奇数行的默认单元格样式。 RowsDefultCellStyle 属性 阅读全文
posted @ 2019-03-23 20:33 厦门哈韩 阅读(106) 评论(0) 推荐(0)
摘要: 关于DataGridView行和列的背景色-前景色设置 1.设定DataGridView全部单元格的Style DataGridView内所有单元格的Style变更,可以使用DataGridView对象的DefaultCellStyle属性实现。 1 2 3 4 5 //包含Header所有的单元格 阅读全文
posted @ 2019-03-23 20:31 厦门哈韩 阅读(271) 评论(0) 推荐(0)
摘要: 例子一: private void dataGridView1_RowPrePaint(object sender, DataGridViewRowPrePaintEventArgs e) { { if(e.RowIndex < dataGridView1.Rows.Count -1) { Data 阅读全文
posted @ 2019-03-23 20:20 厦门哈韩 阅读(165) 评论(0) 推荐(0)
摘要: public Form1() { InitializeComponent(); LoadData(); } private void LoadData() { DataTable tblDatas = new DataTable(); tblDatas.Columns.Add("ID", Type. 阅读全文
posted @ 2019-03-23 20:15 厦门哈韩 阅读(291) 评论(0) 推荐(0)
摘要: 方法一、DataGridView隔行显示不同的颜色 AlternatingRowsDefaultCellStyle 属性 获取或设置应用于 DataGridView 的奇数行的默认单元格样式。RowsDefaultCellStyle 属性 获取或设置应用于 DataGridView 的行单元格的默认 阅读全文
posted @ 2019-03-23 20:13 厦门哈韩 阅读(178) 评论(0) 推荐(0)
摘要: /// <summary>/// 判断字符串是否是数字/// </summary>public static bool IsNumber(string s){ if (string.IsNullOrWhiteSpace(s)) return false; const string pattern = 阅读全文
posted @ 2019-03-23 19:41 厦门哈韩 阅读(125) 评论(0) 推荐(0)
摘要: C#判断一个string是否为数字 案一:Try...Catch(执行效率不高) private bool IsNumberic(string oText) { try { int var1=Convert.ToInt32 (oText); return true; } catch { return 阅读全文
posted @ 2019-03-23 19:39 厦门哈韩 阅读(150) 评论(0) 推荐(0)