摘要: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"/> <
阅读全文
摘要:代码: public class WriteableBitmapGraphic : IDisposable { public WriteableBitmap Source { get; private set; } public System.Drawing.Bitmap bitmap { get;
阅读全文
摘要:

public interface IInputSignal { bool IsMatch(InputEventArgs args); } public class KeyDownSignal : KeySignal { public KeyDownSignal(Key key) : base(key
阅读全文
摘要:WPF默认是跟随系统DPI变化(缩放与布局)而缩放窗体的; 微软把它称为默认DPI感知,当DPI发生变化时WPF感知到后缩放窗体,介绍链接:设置进程的默认 DPI 感知 (Windows) - Win32 apps | Microsoft Learn 如果我们不希望窗体被缩放,而是让窗体使用显示器D
阅读全文
摘要:/// <summary> /// 自动增长序号列 /// </summary> public class DataGridRowIndexColumn : DataGridTextColumn { /// <summary> /// 可以指定开始序号 /// </summary> public i
阅读全文
摘要:属性: StartAngle: 起点角度; EndAngle: 终点角度; IsStartCenter:是否从圆心开始画线; IsClosed:是否封闭; 使用方式: <control:Arc Width="100" Height="100" StartAngle="110" EndAngle="-
阅读全文
摘要:123 public class User32 { public struct RECT { public int LeftTopX; public int LeftTopY; public int RightBottomX; public int RightBottomY; public RECT
阅读全文
摘要:1 [TemplatePart(Name = "PART_Highlight", Type = typeof(Image))] 2 public class ImageControl : Control 3 { 4 Image HighLightImage = null; 5 6 public bo
阅读全文
摘要:方式一 增加了缩放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 partial class MainWindow : Window { public MainWindow() { InitializeComponent(); WindowStyle = WindowStyle.None; if (IsWindows8x()) { Re
阅读全文
摘要:效果图: cs: 1 /// <summary> 2 /// ColorPick.xaml 的交互逻辑 3 /// </summary> 4 public partial class ColorPick : UserControl 5 { 6 ChangeSource _changeSource;
阅读全文
摘要:<Window DataContext="{Binding MyViewModelInstance}"> <ListBox ItemsSource="{Binding MyDataItems}"> <ListBox.ContextMenu> <ContextMenu DataContext="{Bi
阅读全文
摘要:先看效果图: 黑色是需要经过的点; 黄色为控制点; 绿色为两点之间的中点。 方式一: 方式二: <Canvas x:Name="canvas2"/> 方法一代码,【这是别人的代码,时间久了忘记原出处了】: Path path; public void UpdateRoad(List<Point> l
阅读全文
摘要:private void Tb_PreviewKeyDown(object sender, KeyEventArgs e) { bool isNumber = e.Key >= Key.D0 && e.Key <= Key.D9 || e.Key >= Key.NumPad0 && e.Key <=
阅读全文
摘要:#region MyRegion private IntPtr programIntPtr = IntPtr.Zero; bool inited { get; set; } public void Init() { try { if (inited) return; // 通过类名查找一个窗口,返回
阅读全文
摘要:1 public class DragMoveBehavior : Behavior<UIElement> { Window window; Canvas parent; bool isDown; Point prePosition = new Point(); public Type Target
阅读全文
摘要:来自:https://stackoverflow.com/questions/8311805/bitmapsource-copypixels-byte-bitmapsource-how-to-do-this-simple
阅读全文
摘要:> BeginInit > EndInit > OnInitialized > MeasureOverride > ArrangeOverride > GetLayoutClip > OnRender > OnRenderSizeChanged > MeasureOverride > Arrange
阅读全文