摘要:123 public class City { public int Id { get; set; } public string Name { get; set; } public List<City> Cities { get; set; } = new List<City>(); public
阅读全文
摘要:Animation using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Security.Cryptography; using Syste
阅读全文
摘要:public class FPSBase { public static void Run() { CompositionTarget.Rendering += CompositionTarget_Rendering; } public static TimeSpan RunTime { get;
阅读全文
摘要:界面: <DockPanel Background="#EEEEEE"> <WrapPanel DockPanel.Dock="Top"> <Border Background="Green" Width="20" Height="20" VerticalAlignment="Center"/> <
阅读全文
摘要:查看代码 [System.AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct, Inherited = false, AllowMultiple = false)] public class DbTableAttribute
阅读全文
摘要:public class Bmp : IDisposable { /* * 每行像素数据必须是4的倍数 * 黑白二值图0表示黑,1表示白 */ public int Width { get => _width; } public int Height { get => Math.Abs(_heigh
阅读全文
摘要:.NET: public static class TypeUtil { public static Type? GetType(string assemblyName, string typePath) { var assembly = Assembly.Load(assemblyName); i
阅读全文
摘要:关键词:returning 返回所有列:returning *; 返回指定列:returning columnname; 删除命令不支持returning 参考代码: string path = @"Data Source=D:\Data\data.sqlite;Version=3"; using
阅读全文
摘要:public enum TanglecySide { None = 1, LeftToRight = 1 >> 1, RightToLeft = 1 >> 2, TopBottom = 1 >> 3, BottomToTop = 1 >> 4, LeftToLeft = 1 >> 5, RightT
阅读全文
摘要:1.透明图片“瘦身” public Bitmap Slim(Bitmap bitmap) { int x = bitmap.Width, y = bitmap.Height, m = -1, n = -1; for (int i = 0; i < bitmap.Width; i++) { for (
阅读全文
摘要:123 public class User32 { public struct RECT { public int LeftTopX; public int LeftTopY; public int RightBottomX; public int RightBottomY; public RECT
阅读全文
摘要:解决办法:将XmlReaderSettings的值CheckCharacters = false 如下: using (StreamReader sr = new StreamReader(xmlfilePath)) { var setting = new XmlReaderSettings { C
阅读全文
摘要:1. ManualResetEvent,AutoResetEvent WaitOne() 当前线程进入等待状态; Reset() 表示需要等待; Set() 表示等待结束,执行WaitOne()后面代码; 区别: 当有多个线程调用WaitOne()时, AutoResetEvent 执行Set()后
阅读全文
摘要:public class XMLHelper { public static string Serialize<T>(T entity, Encoding encoding = null) { StringBuilder sb = new StringBuilder(); XmlSerializer
阅读全文
摘要:1 public static byte[] ToArray(this Bitmap bitmap) 2 { 3 var lockbits = bitmap.LockBits(new Rectangle(0, 0, bitmap.Width, bitmap.Height), ImageLockMod
阅读全文
摘要:方式一 增加了缩放Maximun、Minimun和Value值,以及可供监听缩放变化的ValueChanged事件。 public class ScaleScrollView : ScrollViewer { readonly List<object> ValueChangedEvents = ne
阅读全文
摘要:点击查看方式二 public class ScaleScrollView : ScrollViewer { List<object> MouseWheelEvents = new List<object>(); /// <summary> /// 通过监听此事件对内容进行缩放 /// </summa
阅读全文
摘要:public static List<T> ToListModel<T>(this DataTable dt) { if (dt.Rows.Count <= 0) return null; string typeName = typeof(T).Name; using (MemoryStream m
阅读全文
摘要:public static string GetFileMD5(string filePath) { using (FileStream fs = new FileStream(filePath, FileMode.Open)) { System.Security.Cryptography.MD5C
阅读全文
摘要:先看效果图: 黑色是需要经过的点; 黄色为控制点; 绿色为两点之间的中点。 方式一: 方式二: <Canvas x:Name="canvas2"/> 方法一代码,【这是别人的代码,时间久了忘记原出处了】: Path path; public void UpdateRoad(List<Point> l
阅读全文