C#Winform 各种控件缩写总结

标准控件1 btn Button2 chk CheckBox3 ckl CheckedListBox4 cmb ComboBox5 dtp DateTimePicker6 lbl Label7 llb LinkLabel8 lst ListBox9 lvw ListView10 mtx MaskedTextBox11 cdr MonthCalendar12 icn No …… 阅读全文

C#判断两个字符串是否相等的方法

string str1="Test"; string str2 = "Test"; if (str1==str2) //第一种判断方式 { //第二种判断方式 int result1 = str1.CompareTo(str2); …… 阅读全文

C#Winform中DataGridView控件下的右键菜单事件获取行值方法

//首先生成DataGridView的CellMouseDown事件 private void dataGridView1_CellMouseDown(object sender, DataGridViewCellMouseEventArgs e) { //循环遍历每一行,设置为不选中状态 for (int i = 0 …… 阅读全文

C#生成图片验证码

private void CreateImage(string codes) { try { int iMapWidth = codes.Length * 21; Bitmap map = new Bitmap(iMapWidth, 28); //创建图片背景 …… 阅读全文

C#ListView控件的相关用法

private void LoadData() { string sql = @"select 编号,姓名,性别,住址 from 学生表"; DataTable dt = DBUtil.GetData(sql); if (dt.Rows.Count==0) { …… 阅读全文

C#关于取DataTable中中间数据的方法

DataTable dt = new DataTable();var test = dt.AsEnumerable();//跳过dt的前200行,取后100行 即取得200-300行test.Skip(200).Take(100); …… 阅读全文

C#打印GroupBox控件区域

//用到的三个控件分别是 printDocument(区域) 、printPreviewDialog(预览)、(pageSetupDialog设置) protected void Init() { this.printDocument1.OriginAtMargins = true; //启用页边距 …… 阅读全文

C#Winform子报表功能

1.建立两张报表:RepMain.rdlc / RepMainChild.rdlic2.在RepMain.rdlc中添加Subreport控件3.核心代码如下using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Dra …… 阅读全文