摘要: 字符串转rtf值 //字符串转rtf public string str2Rtf(string s) { string rtfFormattedString = ""; RichTextBox richTextBox = new RichTextBox(); richTextBox.Text = s 阅读全文
posted @ 2022-06-30 17:16 码农阿亮 阅读(151) 评论(0) 推荐(0) 编辑
摘要: 打开文件 ​```C# private void selectFile() { OpenFileDialog openFileDialog = new OpenFileDialog(); openFileDialog.Filter = "Files|*.png;*.jpg"; // 设定打开的文件类 阅读全文
posted @ 2022-06-30 17:13 码农阿亮 阅读(2334) 评论(0) 推荐(0) 编辑
摘要: public static bool DownLoadFiles(string uri, string filefullpath, int size = 1024) { try { if (File.Exists(filefullpath)) { try { File.Delete(filefull 阅读全文
posted @ 2022-06-30 17:11 码农阿亮 阅读(715) 评论(0) 推荐(0) 编辑
摘要: 等比例压缩 /// <summary> /// 压缩图片 /// </summary> /// <param name="filePath">文件路径</param> /// <param name="height">图像高度</param> /// <returns></returns> publ 阅读全文
posted @ 2022-06-30 17:08 码农阿亮 阅读(422) 评论(0) 推荐(0) 编辑
摘要: /// <summary> /// 写文件导到磁盘(异步) /// </summary> /// <param name="stream">数据流</param> /// <param name="path">文件路径</param> /// <returns></returns> public s 阅读全文
posted @ 2022-06-30 17:05 码农阿亮 阅读(179) 评论(0) 推荐(0) 编辑
摘要: AES加密与解密 ​ /// <summary> /// AES 加密 /// </summary> /// <param name="str">明文</param> /// <param name="aesKey">密钥</param> /// <returns></returns> public 阅读全文
posted @ 2022-06-30 17:03 码农阿亮 阅读(3819) 评论(0) 推荐(1) 编辑
摘要: /// <summary> /// 随机数 /// </summary> /// <param name="Length">长度</param> /// <returns></returns> public static string GenerateRandomNumber(int Length) 阅读全文
posted @ 2022-06-30 16:56 码农阿亮 阅读(223) 评论(0) 推荐(0) 编辑
摘要: 播放Mp3音频 /// <summary> /// 播放音频, /// 1.添加新引用 COM组件的Microsoft Shell Controls And Automation /// 2.添加成功,引用中显示的为Shell32.dll,、 /// 3.设置Shell32.dll的属性为嵌入互操作 阅读全文
posted @ 2022-06-30 16:52 码农阿亮 阅读(1440) 评论(0) 推荐(0) 编辑
摘要: 计算音频的时长 /// <summary> /// 获取mp3文件的歌曲时间长度 /// </summary> /// <param name="songPath"></param> /// <returns></returns> private string GetMp3Times(string 阅读全文
posted @ 2022-06-30 16:51 码农阿亮 阅读(628) 评论(0) 推荐(0) 编辑
摘要: 获取本机IP /// <summary> /// 获取本机IP地址 /// </summary> /// <returns></returns> private string GetHostAddressIP() { IPHostEntry ipHostEntry = Dns.GetHostEntr 阅读全文
posted @ 2022-06-30 16:49 码农阿亮 阅读(353) 评论(0) 推荐(0) 编辑
摘要: 删除时间范围外文件 private static void DeleteOldLogs() { try { // string s =Directory.GetCurrentDirectory(); var path = Application.StartupPath + "\\ErrLog"; i 阅读全文
posted @ 2022-06-30 16:48 码农阿亮 阅读(37) 评论(0) 推荐(0) 编辑
摘要: 根据进程名称关闭 public static void KillProcess(string Pname) { foreach (var v in Process.GetProcessesByName(Pname) { v.Kill(); } } 阅读全文
posted @ 2022-06-30 16:47 码农阿亮 阅读(150) 评论(0) 推荐(0) 编辑
摘要: 窗体关闭事件 private void FrmMain_FormClosing(object sender, FormClosingEventArgs e) { try { if (e.CloseReason == CloseReason.UserClosing) { if (MessageBox. 阅读全文
posted @ 2022-06-30 16:45 码农阿亮 阅读(53) 评论(0) 推荐(0) 编辑