随笔分类 -  C# 工具方法

摘要:private void index_Load(object sender, EventArgs e) { PrintDocument print = new PrintDocument(); string sDefault = print.PrinterSettings.PrinterName;/ 阅读全文
posted @ 2020-04-08 09:55 饮木 阅读(444) 评论(0) 推荐(0) 编辑
摘要:[DllImport("user32.dll", EntryPoint = "SystemParametersInfo")] public static extern int SystemParametersInfo( int uAction, int uParam, string lpvParam 阅读全文
posted @ 2020-04-08 09:47 饮木 阅读(714) 评论(0) 推荐(0) 编辑
摘要:Document doc = new Document("f:\\333.doc"); ImageSaveOptions iso = new ImageSaveOptions(SaveFormat.Jpeg); iso.Resolution = 128; iso.PrettyFormat = tru 阅读全文
posted @ 2020-04-08 09:46 饮木 阅读(1683) 评论(0) 推荐(0) 编辑
摘要:if(dict.ContainsKey(T key)) { //已存在key } 阅读全文
posted @ 2020-01-15 14:37 饮木 阅读(16871) 评论(0) 推荐(1) 编辑
摘要:/// <summary> /// 获得电脑SN号 /// </summary> public static string GetPcsnString() { var pcsn = ""; try { var search = new ManagementObjectSearcher("SELECT 阅读全文
posted @ 2019-12-13 09:07 饮木 阅读(1094) 评论(0) 推荐(0) 编辑
摘要:/// <summary> /// 写入记事本 /// </summary> /// <param name="log">日志内容</param> /// <param name="filepath">文件路径(含文件名)</param> /// <returns></returns> privat 阅读全文
posted @ 2019-11-04 16:11 饮木 阅读(4640) 评论(0) 推荐(0) 编辑
摘要:Dictionary dic = new Dictionary(); Dictionary.Enumerator en = dic.GetEnumerator(); for (int i = 0; i < dic.Count; i++) { if (en.MoveNext()) ... 阅读全文
posted @ 2019-10-29 11:44 饮木 阅读(1075) 评论(0) 推荐(0) 编辑
摘要:1、新建桌面 > Ctrl + Win + D 2、切换桌面 > Ctrl + Win + 左键(右键) 阅读全文
posted @ 2019-10-28 14:59 饮木 阅读(154) 评论(0) 推荐(0) 编辑
摘要:服务器Windows Server 2008 R2 1、打开控制面板。 2、点击“检查防火墙状态”。 3、点击左侧“高级设置”。 4、选中“入栈规则”。 5、右侧点击“新建规则”。 6、选择“端口”。 7、选择“TCP”,选中“特定端口”并输入你要开发的端口,或者输入你要开放的端口的区间。 8、勾选 阅读全文
posted @ 2019-10-23 16:37 饮木 阅读(5421) 评论(0) 推荐(0) 编辑
摘要:cmd --> netstat-nao 阅读全文
posted @ 2019-10-23 16:28 饮木 阅读(177) 评论(0) 推荐(0) 编辑
摘要:string path = @"d:\test"; if (false == System.IO.Directory.Exists(path)) { //创建pic文件夹 System.IO.Directory.CreateDirectory(path); } 阅读全文
posted @ 2019-09-16 14:53 饮木 阅读(311) 评论(0) 推荐(0) 编辑
摘要:SaveFileDialog sfd = new SaveFileDialog(); sfd.Filter = "Excel表格(*.xlsx)|*.xlsx"; sfd.FilterIndex = 1; sfd.RestoreDirectory = true; if (sfd.ShowDialog() == DialogResult.OK) { MessageBox.Show(sfd.FileN 阅读全文
posted @ 2019-09-16 09:08 饮木 阅读(8746) 评论(0) 推荐(0) 编辑
摘要:string pLocalFilePath ="";//要复制的文件路径 string pSaveFilePath ="";//指定存储的路径 if (File.Exists(pLocalFilePath))//必须判断要复制的文件是否存在 { File.Copy(pLocalFilePath, pSaveFilePath, true);//三个参数分别是源文件路径,存储路径,若存储路径有相同文件 阅读全文
posted @ 2019-09-01 11:03 饮木 阅读(17978) 评论(0) 推荐(2) 编辑
摘要:private string GetWeek() { string week = string.Empty; switch ((int)DateTime.Now.DayOfWeek) { case 0: week = "星期日";... 阅读全文
posted @ 2019-08-13 11:09 饮木 阅读(11031) 评论(0) 推荐(1) 编辑

点击右上角即可分享
微信分享提示