X3

RedSky

导航

2022年3月22日 #

WPF 可缩放ScrollView(方式一)

摘要: 点击查看方式二 public class ScaleScrollView : ScrollViewer { List<object> MouseWheelEvents = new List<object>(); /// <summary> /// 通过监听此事件对内容进行缩放 /// </summa 阅读全文

posted @ 2022-03-22 10:04 HotSky 阅读(568) 评论(0) 推荐(0)

2021年9月14日 #

c#datatable序列化xml

摘要: public static List<T> ToListModel<T>(this DataTable dt) { if (dt.Rows.Count <= 0) return null; string typeName = typeof(T).Name; using (MemoryStream m 阅读全文

posted @ 2021-09-14 15:29 HotSky 阅读(387) 评论(0) 推荐(0)

2021年6月24日 #

WPF窗体透明Win7,Win10不同处理方法

摘要: 直接上代码: public partial class MainWindow : Window { public MainWindow() { InitializeComponent(); WindowStyle = WindowStyle.None; if (IsWindows8x()) { Re 阅读全文

posted @ 2021-06-24 18:01 HotSky 阅读(271) 评论(0) 推荐(0)

2021年6月21日 #

WPF颜色选择控件

摘要: 效果图: cs: 1 /// <summary> 2 /// ColorPick.xaml 的交互逻辑 3 /// </summary> 4 public partial class ColorPick : UserControl 5 { 6 ChangeSource _changeSource; 阅读全文

posted @ 2021-06-21 10:16 HotSky 阅读(524) 评论(0) 推荐(0)

2021年6月9日 #

WPF ContextMenu绑定

摘要: <Window DataContext="{Binding MyViewModelInstance}"> <ListBox ItemsSource="{Binding MyDataItems}"> <ListBox.ContextMenu> <ContextMenu DataContext="{Bi 阅读全文

posted @ 2021-06-09 15:46 HotSky 阅读(508) 评论(0) 推荐(0)

2021年3月2日 #

C#获取文件MD5

摘要: public static string GetFileMD5(string filePath) { using (FileStream fs = new FileStream(filePath, FileMode.Open)) { System.Security.Cryptography.MD5C 阅读全文

posted @ 2021-03-02 09:25 HotSky 阅读(311) 评论(0) 推荐(0)

2020年9月2日 #

WPF点连成曲线,贝塞尔曲线两种画法

摘要: 先看效果图: 黑色是需要经过的点; 黄色为控制点; 绿色为两点之间的中点。 方式一: 方式二: <Canvas x:Name="canvas2"/> 方法一代码,【这是别人的代码,时间久了忘记原出处了】: Path path; public void UpdateRoad(List<Point> l 阅读全文

posted @ 2020-09-02 10:49 HotSky 阅读(2319) 评论(0) 推荐(0)

2020年6月2日 #

WPF TextBox输入限制,只能输入数字,字母

摘要: private void Tb_PreviewKeyDown(object sender, KeyEventArgs e) { bool isNumber = e.Key >= Key.D0 && e.Key <= Key.D9 || e.Key >= Key.NumPad0 && e.Key <= 阅读全文

posted @ 2020-06-02 11:28 HotSky 阅读(1821) 评论(0) 推荐(0)

2020年5月13日 #

c# ActiveMQ的使用

摘要: /// <sumary>/// 接收方/// </sumary>public void StartClient() { var factory = new NMSConnectionFactory(new Uri("activemq:failover:(tcp://localhost:61616/? 阅读全文

posted @ 2020-05-13 14:38 HotSky 阅读(749) 评论(0) 推荐(0)

WPF将窗体设置为桌面背景【动态桌面】

摘要: #region MyRegion private IntPtr programIntPtr = IntPtr.Zero; bool inited { get; set; } public void Init() { try { if (inited) return; // 通过类名查找一个窗口,返回 阅读全文

posted @ 2020-05-13 10:32 HotSky 阅读(1095) 评论(0) 推荐(0)