随笔分类 - Visual C#
摘要:加密后乱码加密解密加密后 /// /// 加密 /// /// /// 数值1-1024 /// 加密后文件是乱码的 public static string MakePasswordText(string str, int key) { //string s...
阅读全文
摘要:namespace System {/*参考://https://www.cnblogs.com/banhua/archive/2012/07/13/2590920.html*/ using System.Collections.Generic; using System.Text; using System.Runtime.InteropServices; class S...
阅读全文
摘要:/// /// 转换成时间 00:00:00/// /// /// public string time(long duration){ TimeSpan t = new TimeSpan(0, 0, Convert.ToInt32(duration)); //string str = "00:00:00"; return $"{t.Hours:00}:{t.Minutes:...
阅读全文
摘要:像sql数据链接字符串不能出现的特殊字符 单引号‘、双引号“、斜杠\、大于号>、 " 编码后 [ə'prɑksɪmət] < > "通过使用 HttpUtility类 实现上面2种编码与转换//需要引用using System.Web;//解码textBox1.Text = HttpUtility.HtmlEncode(textBox1.Text);//编码text...
阅读全文
摘要:using System;using System.Collections;using System.Linq;namespace ConsoleApp1 { class Program { static void Main(string[] args) { string[] array = { "a.m.", "a", "Smith", "Jones",...
阅读全文
摘要:2020年1月9日 17:50:55附件https://files.cnblogs.com/files/xe2011/ListBoxSort.rar这种方法 如果内容足够多就能看到滚动条闪烁了,我觉得这是列表框清除内容,再添加内容引起的。用不删除列表,重新赋值的方法能解释闪烁,但过程时间又太长。using System;using System.Collections.Generic;using ...
阅读全文
摘要:单词全字匹配查找用的是 单词边界 \b查找的关键字\bstring类中有个IndexOf和Contains方法,但这2个方法都是包含的意思。包含从下面这个图可以看出边界和包含的区别,下面每一行都包含roman这个关键字,但不是每行都全字匹配roman的 (这里正则开启了忽略大小写了).此图中包含 每行都有roman ,相当于string类的IndexOf,Contains边界限制此图是是使用了边界...
阅读全文
摘要:Stopwatch Timer 时间 计时器 ElapsedMilliseconds /// /// 转换成时间 00:00:00 /// /// /// public string time(long duration) { TimeSpan t = new TimeSpan(0...
阅读全文
摘要:Image.FromFile 之后无法删除这个文件 pictrue图片是从文件加载的,现在想换张图片,更改之前要删除原有的文件,在删除原有的文件出现了异常 解决办法 使用 Stream 2019年12月8日 19:13:03
阅读全文
摘要:ResourceManager.GetObject根据名称从资源中取出资源需要:我有25张 五笔图片名称是a b c d ...y 这样组成的 每张图片名字只有一个名字我想通过字符串a取出a这张图片我想通过字符串b取出b这张图片我想通过字符串c取出c这张图片...如果用if来判断的话得26个if,但我只想用一句来判断object obj = Properties.Resources.Resourc...
阅读全文
摘要:只要有一个字符和其他字符不一样,结果为假,不再继续往下判断。 当判断到最后依然没有不一样的,则当前字符串由同一个字符组成的
阅读全文
摘要:目录 <!--[if supportFields]><span lang=EN-US style='font-size:18.0pt;font-family:"Courier New"'><span style='mso-element:field-begin'></span><span style
阅读全文
摘要:C# 操作INI 文件附件:http://files.cnblogs.com/xe2011/IniFiles_WindowsFormsApplication1.rar使用 //AppDomain.CurrentDomain.BaseDirectory+"abc.ini"//stringprivat...
阅读全文
摘要:private bool SaveToFile(string sText,string sFileName) { try { System.IO.StreamWriter sw = System.IO.File.CreateText(sFileName); sw.WriteLine(sText); return true; } catch { ret...
阅读全文
摘要:数组 arr = { 9,2,42,12,34,0,-11,45};数组的长度 = 8(个元素)数组的第0个元素为 9数组的第1个元素为2...数组的第N个元素为 N-1using System;namespace ConsoleApplication1{ class Program { static void Main(string[] args) { int[] arr = { 9,2,42,12,34,0,-11,45}; Console.WriteLine("arr={ 9,2,42,12,34,0,-...
阅读全文
摘要:using System;using System.Data;using System.Windows.Forms;namespace WindowsFormsApplication1{ public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { DataTabl...
阅读全文
摘要:附件 http://files.cnblogs.com/xe2011/CSharpTextRuler.rar原文 http://www.codeproject.com/Articles/22783/Advanced-Text-Editor-with-Ruler原文的附件:http://files.cnblogs.com/xe2011/TextRuler.rar 1 using System; 2 using System.Collections.Generic; 3 using System.ComponentModel; 4 using System.Drawing; 5 usin...
阅读全文
摘要:.NET Framework 类库 ListBox.ItemHeight 属性 当 DrawMode 属性设置为 DrawMode.OwnerDrawFixed 时,所有项具有相同的高度。当 DrawMode 属性设置为 DrawMode.OwnerDrawVariable 时,ItemHeight 属性指定添加到 ListBox 中的每个项的高度。因为所有者描述的列表中的每个项可具有不同的高度,所以可使用 GetItemHeight 方法获取 ListBox 中特定项的高度。如果对具有可变高度的项的 ListBox 使用 ItemHeight 属性,则此属性返回控件中第一个项的高度。List
阅读全文
摘要:普通方法这种方法尽管很SB但确实可以解决问题 private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { string SelPath = ""; switch (comboBox1.SelectedIndex) { case 0: SelPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Applicat...
阅读全文
摘要:在VS2008中做的附件:http://ys-e.ys168.com/2.0/276581430/j4G4J63367LMMJUJjsgW/CSHARP_WinCtrl21t_2014%E5%B9%B45%E6%9C%8831%E6%97%A592228.rar描述:文件以RTF格式保存在本地可以用...
阅读全文