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