文章分类 -  C# 那些事儿

摘要:(1)列表头创建(记得,需要先创建列表头) ColumnHeader ch= new ColumnHeader(); ch.Text = "列标题1"; //设置列标题 ch.Width = 120; //设置列宽度 ch.TextAlign = HorizontalAlignment.Left; //设置列的对齐方式 this.listView1.Co... 阅读全文
posted @ 2018-01-04 11:26 都是城市惹的祸 阅读(144) 评论(0) 推荐(0)
摘要:找了很多都说DataGridView有一个属性AutoSizeColumnMode,他有很多枚举值: 1、AllCells 调整列宽,以适合该列中的所有单元格的内容,包括标题单元格。 2、AllCellsExceptHeader 调整列宽,以适合该列中的所有单元格的内容,不包括标题单元格。 3、ColumnHeader 调整列宽,以适合列标题单元格的内容。 4、DisplayedCe... 阅读全文
posted @ 2018-01-04 11:24 都是城市惹的祸 阅读(2022) 评论(0) 推荐(0)
摘要:string类型转成byte[]: byte[] byteArray = System.Text.Encoding.Default.GetBytes ( str ); byte[]转成string: string str = System.Text.Encoding.Default.GetString ( byteArray ); string类型转成ASCII byte[]... 阅读全文
posted @ 2018-01-04 09:13 都是城市惹的祸 阅读(130) 评论(0) 推荐(0)
摘要:1、用法1: 常规用 增加键值对之前需要判断是否存在该键,如果已经存在该键而且不判断,将抛出异常。所以这样每次都要进行判断,很麻烦,在备注里使用了一个扩展方法 2、用法2:Dictionary的Value为一个数组 3、用法3: Dictionary的Value为一个类 4 备注:Dictionar 阅读全文
posted @ 2018-01-03 10:27 都是城市惹的祸 阅读(190) 评论(0) 推荐(0)
摘要:封装好的类,直接上代码: 阅读全文
posted @ 2018-01-03 10:24 都是城市惹的祸 阅读(107) 评论(0) 推荐(0)
摘要:封装好的类,直接上代码: 阅读全文
posted @ 2018-01-03 10:22 都是城市惹的祸 阅读(448) 评论(0) 推荐(0)
摘要:加密,采用分段的方式,无长度限制: 解密,必须对应: 阅读全文
posted @ 2018-01-03 09:25 都是城市惹的祸 阅读(1291) 评论(0) 推荐(0)
摘要:public string GetGUID() { var uuid = Guid.NewGuid().ToString(); //去掉中间“-” uuid = uuid.Replace("-", ""); //转大写 uuid = uuid... 阅读全文
posted @ 2017-12-26 15:26 都是城市惹的祸 阅读(259) 评论(0) 推荐(0)
摘要:/// /// 运行exe文件,或者图片、txt等 /// /// public void RunExeFile(string file) { if (File.Exists(file)) System.Diagnostics.Process.Start(file); ... 阅读全文
posted @ 2017-12-26 15:24 都是城市惹的祸 阅读(608) 评论(0) 推荐(0)
摘要:/// /// 取文本MD5 /// /// 文本 /// 文本MD5 public string GetTextMd5(string txt) { byte[] result = Encoding.Default.GetBytes(txt); ... 阅读全文
posted @ 2017-12-26 15:23 都是城市惹的祸 阅读(172) 评论(0) 推荐(0)
摘要:/// /// 字符串转整型,异常赋默认值 /// /// 字符串 /// 默认值 /// 整型值 public int StrToIntDef(string s, int defaultValue = 0) { int num; //定义一... 阅读全文
posted @ 2017-12-26 15:22 都是城市惹的祸 阅读(1075) 评论(0) 推荐(0)
摘要:/// /// 数字转中文 /// /// eg: 22 /// public string NumberToChinese(int number) { string res = string.Empty; string str =... 阅读全文
posted @ 2017-12-26 15:22 都是城市惹的祸 阅读(86) 评论(0) 推荐(0)
摘要:private int ZipFile(string FileToZip, string ZipedFile, int CompressionLevel, int BlockSize) { if (!System.IO.File.Exists(FileToZip)) { return -1; ... 阅读全文
posted @ 2017-12-26 15:19 都是城市惹的祸 阅读(1622) 评论(0) 推荐(0)
摘要:/// /// 写入值 /// /// /// public static void SetValue(string key, string value) { //增加的内容写在appSettings段下 System.... 阅读全文
posted @ 2017-12-26 15:16 都是城市惹的祸 阅读(5610) 评论(0) 推荐(0)
摘要:using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.ServiceProcess; using System.Text; using System.Threading.Tasks; namespace ZentaoMailService... 阅读全文
posted @ 2017-12-21 11:37 都是城市惹的祸 阅读(90) 评论(0) 推荐(0)
摘要:取程序所在目录: 阅读全文
posted @ 2017-12-07 10:30 都是城市惹的祸 阅读(119) 评论(0) 推荐(0)
摘要:一、string转json 二、string转jsonArray 阅读全文
posted @ 2017-12-07 10:29 都是城市惹的祸 阅读(5492) 评论(0) 推荐(0)
摘要://把整个文件内容读入字符串变量 string path = @"d:\a.txt"; string s = System.IO.File.ReadAllText(path); 阅读全文
posted @ 2017-12-07 10:07 都是城市惹的祸 阅读(296) 评论(0) 推荐(0)
摘要:1、 FTP命令 FTP 协议中规定了一些大家都认识的命令和组成。FTP协议中的命令都由3~4个字母组成,命令与参数之间用空格隔开,每个命令用回车换行结束。 (1)访问命令 (1)访问命令有: USER命令——格式为:USER <username>, 指定登录的用户名,以便服务器进行身份验证。这个命 阅读全文
posted @ 2017-11-29 10:36 都是城市惹的祸 阅读(3404) 评论(0) 推荐(0)
摘要:1、设置全屏背景图片 2、截图实现 3、快捷键处理 阅读全文
posted @ 2017-11-29 10:32 都是城市惹的祸 阅读(317) 评论(0) 推荐(0)