随笔分类 - C#
摘要:dg.SmoothingMode = SmoothingMode.HighSpeed; //高质量 dg.PixelOffsetMode = PixelOffsetMode.HighSpeed; //高像素偏移质量 dg.CompositingQuality = CompositingQuality
阅读全文
摘要:一: protected override void OnKeyDown(KeyEventArgs e) { if (e.Key==Key.Enter) { sendAppToServer(); } base.OnKeyDown(e); } 二; 下面为监听方向键: protected overri
阅读全文
摘要:using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks; namespace Wolfy.LinqAggregation{ class
阅读全文
摘要:Html互转: string c1 = System.Drawing.ColorTranslator.ToHtml(System.Drawing.Color.Red); System.Drawing.Color c2 = System.Drawing.ColorTranslator.FromHtml
阅读全文
摘要://获取日期+时间 DateTime.Now.ToString(); // 2008-9-4 20:02:10 DateTime.Now.ToLocalTime().ToString(); // 2008-9-4 20:12:12 //获取日期 DateTime.Now.ToLongDateStri
阅读全文
摘要:private string ConvertJsonString(string str) { //格式化json字符串 JsonSerializer serializer = new JsonSerializer(); TextReader tr = new StringReader(str); J
阅读全文
摘要:添加缓冲: private void SetDoubleBuffer() { base.SetStyle( ControlStyles.OptimizedDoubleBuffer | ControlStyles.ResizeRedraw | ControlStyles.Selectable | Co
阅读全文
摘要:首先说明一个示例,分析一下Filter属性的构成:“ Excel文件|*.xls ”,前面的“Excel文件”成为标签,是一个可读的字符串,可以自定定义,“|*.xls”是筛选器,表示筛选文件夹中后缀名为.xls的文件,“*”表示匹配Excel文件名称的字符串。OK,下面说说我们经常要用到的几种情况
阅读全文
摘要:public void FileCopy(string source, string target) { using (FileStream fileRead = new FileStream(source, FileMode.Open, FileAccess.Read,FileShare.Read
阅读全文
摘要:string path = "test.txt"; FileStream mystream = new FileStream(path, FileMode.OpenOrCreate); StreamWriter myWrite = new StreamWriter(mystream); myWrit
阅读全文
摘要:System.Math.Abs(float value); System.Math.Abs(decimal value); System.Math.Abs(int value); System.Math.Abs(double value); System.Math.Abs(sbyte value);
阅读全文
摘要:private string ConvertStringToJson(string str) { //格式化json字符串 JsonSerializer serializer = new JsonSerializer(); TextReader tr = new StringReader(str);
阅读全文
摘要:public void GetIPAddress() { string resultIP = string.Empty; System.Net.IPAddress[] ips = System.Net.Dns.GetHostEntry(System.Net.Dns.GetHostName()).Ad
阅读全文
摘要:this.MaximizedBounds = Screen.PrimaryScreen.WorkingArea; 在初始话后添加这个即可实现,。。。。。。。。。。。。。。。
阅读全文
摘要:XmlDocument xmlDoc = new XmlDocument(); //假定该xmlDoc已经有内容; MemoryStream streamXml = new MemoryStream(); XmlTextWriter writer = new XmlTextWriter(stream
阅读全文
摘要:private void CopyDirectory(string srcPath, string desPath) { string folderName = srcdir.Substring(srcdir.LastIndexOf("\\")+1); string desfolderdir = d
阅读全文
摘要:public bool CopyOldLabFilesToNewLab(string sourcePath, string savePath) { if (!Directory.Exists(savePath)) { Directory.CreateDirectory(savePath); } #r
阅读全文
摘要:string filePath = "C:\\1.txt"; string str = "获取文件的全路径:" + Path.GetFullPath(filePath); //-->C:1.txt str = "获取文件所在的目录:" + Path.GetDirectoryName(filePath
阅读全文
摘要:List<String> listFile = new List<String>(); public void director(string path) { //绑定到指定的文件夹目录 DirectoryInfo dir = new DirectoryInfo(path); //检索表示当前目录的
阅读全文