c#
seven_apple
这个作者很懒,什么都没留下…
展开
-
C#WinForm开发之DataGridView 中合并单元格
Windows Forms DataGridView 没有提供合并单元格的功能,要实现合并单元格的功能就要在CellPainting事件中使用Graphics.DrawLine和 Graphics.DrawString 自己来“画”。下面的代码可以对DataGridView第1列内容相同的单元格进行合并: private void dataGridView1_CellPainting(object sender, DataGridViewCellPaintingEventArgs e)转载 2021-02-04 16:06:09 · 1547 阅读 · 0 评论 -
C# DataGridView合并单元格
private void dataGridView1_CellPainting(object sender, DataGridViewCellPaintingEventArgs e) { if (e.RowIndex >= 0 && e.ColumnIndex >= 0 && e.Value.ToString() != string.Empty) { //if (!s.原创 2021-02-04 15:53:18 · 4496 阅读 · 2 评论 -
C# 引用配置文件app.config
配置文件app.config1.app.config内参数的增加<connectionStrings> <add name="constr" connectionString="Data Source=.;Initial Catalog=****;USER=****;PASSWORD=****"/> </connectionStrings>添加引用System.Configuration获取参数字符串 string connectstr= C原创 2021-01-11 22:19:34 · 552 阅读 · 0 评论 -
c# 简单的登录界面账号密码登录判断
登录界面账号密码登录判断 SqlConnection cn = new SqlConnection(" Data Source=.\\sqlexpress;Initial Catalog=stuinfo;Integrated Security=True"); string sql = "select count(*) from Login where User_ID=@User_ID and User_Pwd=@User_Pwd";原创 2020-10-19 20:50:20 · 3497 阅读 · 0 评论 -
C# dataGridView展示数据库查询结果
C# dataGridView展示数据库查询结果 private void browsetc() { //SqlConnection cn = new SqlConnection(sqlText.sql); login frmlg = new login(); string urlIP = "Data Source =" + frmlg.textIP.Text.Trim() + sqlText.sql;原创 2020-10-11 13:15:42 · 1486 阅读 · 0 评论 -
c# comboBox展示数据库列
comboBox展示数据库列//COMBOBOX展示数据库 private void cmbox() { // SqlConnection con = new SqlConnection(sqlText.sql); login frmlg = new login(); string urlIP = "Data Source =" + frmlg.textIP.Text.Trim() + sqlText.原创 2020-10-11 13:10:35 · 688 阅读 · 0 评论 -
C# 统计 dataGridView行数
统计 dataGridView行数//dataGridView行数统计label20.Text = dataGridView2.Rows.Count.ToString();原创 2020-10-10 15:43:38 · 3129 阅读 · 0 评论 -
c# dataGridView 控件显示行号
dataGridView 控件显示行号 private void dataGridView1_RowPostPaint(object sender, DataGridViewRowPostPaintEventArgs e) { Rectangle rect = new Rectangle(e.RowBounds.Location.X, e.RowBounds.Location.Y, dataGridView1.RowHeadersWidth - 4, e原创 2020-10-10 15:23:49 · 463 阅读 · 0 评论 -
C#的MessageBox常用代码和效果(带图)
MessageBox常用代码和效果1.单纯显示提示信息 MessageBox.Show("你好!");2.提示信息+标题 MessageBox.Show("你好!","提示");3.提示信息+标题+提示图标 MessageBox.Show("你好!","提示",MessageBoxButtons.OK,MessageBoxIcon.Warning);4.提示信息+标题+提示图标+是否按钮if (MessageBox.Show("你好!", "提示", MessageBoxButt原创 2020-10-09 15:13:57 · 393 阅读 · 0 评论 -
c#加密和解密base64
using System;using System.Text; namespace Common{/// <summary>/// 实现Base64加密解密/// </summary>public sealed class Base64{/// <summary>/// Base64加密/// </summary>/// <param name="codeName">加密采用的编码方式</param>///原创 2020-10-08 11:27:56 · 245 阅读 · 0 评论 -
C# textbox限制仅输入数字和小数点
public static void Key_Press(KeyPressEventArgs e, TextBox txt) { //if (e.KeyChar != 8 && !char.IsDigit(e.KeyChar)) //{ // e.Handled = true; //} if (((int)e.KeyChar < 48 || (i原创 2020-10-08 11:23:23 · 1180 阅读 · 0 评论 -
C# 登录密码框TextBox显示*或者●
登录密码框显示*或者●选中TextBox属性找到TextBox属性PasswordChar,在后面输入对应的*或者●即可调试效果选中TextBox属性找到TextBox属性PasswordChar,在后面输入对应的*或者●即可调试效果原创 2020-10-05 12:52:47 · 1918 阅读 · 0 评论 -
c# winform登录窗口按enter自动登录设置
键盘按enter自动登录设置1.选择登录窗体属性2.选择AcceptButton ,把AcceptButton 设置成登录按钮,这样敲打回车就会执行登录按钮。原创 2020-10-05 12:38:53 · 1092 阅读 · 0 评论 -
C#窗体间数据传递
C#窗体间数据传递1.新建窗体应用程序:窗体1,拖入控件;2.新建窗体应用程序:窗体2,拖入label控件;3.新建一个类,类中创建一个静态字段;类中代码:public class opname{public static string name;}4.在窗体1中加入代码,原理是窗体1的值传给新建类静态字段,然后取值时直接从静态字段中取值;窗体1代码:opname.name = textBox1.Text;//窗体1的值传给新建类静态字段Form2 frm2 = new F原创 2020-10-05 12:27:04 · 1186 阅读 · 0 评论