会员
众包
新闻
博问
闪存
赞助商
HarmonyOS
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
搬砖码农的一天
博客园
首页
新随笔
联系
管理
订阅
上一页
1
2
3
4
5
下一页
2020年12月14日
如何将C#nullable int转换为int
摘要: 如何将可空int转换为int ? 假设我有两种类型的int,如下所示: int? v1; int v2; //将v1的值分配给v2 。 v2 = v1; 会导致错误。 如何将v1转换为v2? v2 = Convert.ToInt32(v1); v2=(int)v1; //检索对象的值。 如果为nul
阅读全文
posted @ 2020-12-14 14:26 ₯㎕~
阅读(186)
评论(0)
推荐(0)
2020年12月1日
C#设置DataGridView单元格的内容居中显示
摘要: //dgvVisitor 是DataGridView的名称 dgvVisitor.RowsDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; //单元格居中显示 private void dgvVisitor
阅读全文
posted @ 2020-12-01 12:21 ₯㎕~
阅读(2327)
评论(0)
推荐(0)
2020年11月30日
图片自适应pictureBox的大小显示
摘要: #region 在图片框中显示相应大小的图片 private Bitmap ResizeImage(Bitmap bmp, PictureBox picBox) { float xRate = (float)bmp.Width / picBox.Size.Width;//比较picBox的宽度与图片
阅读全文
posted @ 2020-11-30 17:29 ₯㎕~
阅读(522)
评论(0)
推荐(0)
2020年11月23日
C#实现子窗体与父窗体通信方法实例
摘要: 【第一种方法:】 第一步: 创建接口IForm,父窗体继承这个接口 public interface IForm { void RefreshForm(); } 第二步: 父窗体实现接口中的方法,在实现接口的方法中写入刷新代码 Form2 f = new Form2(); f.Owner = thi
阅读全文
posted @ 2020-11-23 15:47 ₯㎕~
阅读(566)
评论(0)
推荐(0)
2020年11月20日
C# Datatable.select 在 Range 对象中,Min (14)必须小于或等于 max (-1)
摘要: DataTable dt = ds.Tables[0]; DataRow[] drs = dt.Select("Id=" + categoryID ); 解决方法:将参数用单引号阔起来 DataRow[] drs = dt.Select("Id='" + categoryID + "'");C# D
阅读全文
posted @ 2020-11-20 16:56 ₯㎕~
阅读(266)
评论(0)
推荐(0)
2020年11月16日
GDI+中发生一般性错误的解决办法
摘要: //错误代码 Bitmap 对象或一个 图像 对象从一个文件, 构造时该文件仍保留锁定对于对象的生存期。 因此, 无法更改图像并将其保存回它产生相同的文件。private static byte[] GetBytes (Image image) { try { if (image == null)
阅读全文
posted @ 2020-11-16 14:57 ₯㎕~
阅读(723)
评论(0)
推荐(0)
2020年11月3日
TreeView实现双击修改树结点名称
摘要: private Point pi;//定义一个坐标变量 //TreeRule为TreeView的Name private void TreeRule_MouseDown(object sender, MouseEventArgs e)//当鼠标指针位于控件上并按下鼠标键时发生 { pi = new
阅读全文
posted @ 2020-11-03 15:43 ₯㎕~
阅读(930)
评论(0)
推荐(0)
2020年9月28日
Dictionary 排序
摘要: //创建字典Dictionary 对象 Dictionary<string, int> dic = new Dictionary<string, int>(); //.net 3.5 以上版本 Dictionary排序(即 linq dictionary 排序) private void Dicto
阅读全文
posted @ 2020-09-28 11:05 ₯㎕~
阅读(373)
评论(0)
推荐(0)
2020年9月16日
将特殊字符全部替换为下划线
摘要: private string ReplaceChange(string str) { if (!string.IsNullOrEmpty(str)) { //将特殊字符全部替换为下划线 string pattern = "[\\[ \\] \\^ \\-_*×――(^)$%~!@#$…&%¥—+=<
阅读全文
posted @ 2020-09-16 16:09 ₯㎕~
阅读(550)
评论(0)
推荐(0)
2020年7月15日
DataGridView操作按钮列(修改、删除)
摘要: //DataGridView扩展类//WDataGridView控件 public class WDataGridViewColumn_EditDelete : DataGridViewColumn { /// <summary> /// 对象名称:DataGridView操作按钮列(修改、删除)
阅读全文
posted @ 2020-07-15 14:53 ₯㎕~
阅读(1707)
评论(0)
推荐(0)
上一页
1
2
3
4
5
下一页
公告