随笔分类 - C#
摘要:ps:提高了编程效率,而且相当好用,自己随时可以添加新的扩展 public static class CommomExtentions { public static bool IsNullOrEmpty(this string str) { return string.IsNullOrEmpty(
阅读全文
摘要:Bitmap b = new Bitmap(Server.MapPath(ppath)); Stream ms = new MemoryStream(); b.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg); 原文: https://www.cnb
阅读全文
摘要:this.dataGridView1.BindingContext[this.dataGridView1.DataSource].Position = 5
阅读全文
摘要:public Image GetHttpImage(string url) { var client = new HttpClient(); var uri = new Uri(Uri.EscapeUriString(url)); byte[] urlContents = client.GetByt
阅读全文
摘要://设置左上角到中心点 g.TranslateTransform(int.Parse(x), int.Parse(y)); //旋转角度 g.RotateTransform(int.Parse("90")); //还原左上角 g.TranslateTransform(-int.Parse(x),-
阅读全文
摘要:static void Main() { //设置应用程序处理异常方式:ThreadException处理 Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException); //处理UI线程异常 Applica
阅读全文
摘要:public static class Ex{ public static T2 Map< T2>(this object t1) where T2 : class { var t1_Pinfos = t1.GetType().GetProperties(); var t2_Pinfos = typ
阅读全文
摘要:nuget 安装 DataMatrix.net //示例 DmtxImageEncoder Die = new DmtxImageEncoder(); DataMatrix.net.DmtxImageEncoderOptions option = new DmtxImageEncoderOption
阅读全文
摘要://调用方式 var frm = new MyForm().Instance(); public static class ExFrm { static Dictionary<string, Form> forms = new Dictionary<string, Form>(); /// <sum
阅读全文
摘要:using NPOI; using NPOI.XSSF.UserModel; using NPOI.SS.UserModel; using NPOI.HSSF.UserModel; NPOI.SS.UserModel.IWorkbook excelbook = null; using (FileSt
阅读全文
摘要://引用 System.IO.Compression.FileSystem.dll var basePath = AppDomain.CurrentDomain.BaseDirectory; System.IO.Compression.ZipFile.CreateFromDirectory(base
阅读全文
摘要:保存: Configuration config = ConfigurationManager.OpenExeConfiguration(Application.ExecutablePath); if (config.AppSettings.Settings.AllKeys.Contains("ke
阅读全文
摘要:OpenFileDialog控件的基本属性InitialDirectory:对话框的初始目录 Filter: 获取或设置当前文件名筛选器字符串,例如,"文本文件(*.txt)|*.txt|所有文件(*.*)||*.*" FilterIndex 在对话框中选择的文件筛选器的索引,如果选第一项就设为1
阅读全文
摘要://要序列化的类型 [Serializable] public class myclass { public string Name {get;set;} } //序列化 var my = new myclass(); my.Name="1234"; my.SerializeSave("D:\\da
阅读全文

浙公网安备 33010602011771号