标签: WPF

8 篇文章

C# 单例应用
using System.Reflection; using System.Threading; public enum MutexScope { Local, Global } public static class SingletonApp { private static Mutex? mutex; public static bool Is…
WPF 文件图标转换器
using System; using System.Drawing; using System.Globalization; using System.IO; using System.Windows; using System.Windows.Data; using System.Windows.Interop; using System.Wi…
UniqueWindow
using System.Collections.Generic; using System.Windows; public class UniqueWindow { private static readonly List<Window> windows = new(); public static T Get<T>() …
WPF 工具窗口
更改指定窗口的属性。 函数还将指定偏移量的 32 位 (长) 值设置为额外的窗口内存。 SetWindowLongA 函数 (winuser.h) WS_EX_TOOLWINDOW 该窗口旨在用作浮动工具栏。 工具窗口具有短于普通标题栏的标题栏和使用较小的字体绘制的窗口标题。 工具窗口不会显示在任务栏中,也不会显示在用户按 Alt+TAB 时显示的…
WPF 应用的 .csproj 建议
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>WinExe</OutputType> <TargetFramework>net8.0-windows</TargetFramework> <Nullable>enable</N…
WPF 重写语言实现本地化
添加这段代码(Application_Startup): FrameworkElement.LanguageProperty.OverrideMetadata( typeof(FrameworkElement), new FrameworkPropertyMetadata( XmlLanguage.GetLanguage(CultureInfo.C…
WPF 热键
using System; using System.Collections.Generic; using System.Runtime.InteropServices; using System.Windows.Input; using System.Windows.Interop; public delegate void HotKeyCall…
WPF 自定义属性
<Window x:Name="window" ...> <Grid> <TextBlock Text="{Binding Text, ElementName=window}" /> </Grid> </Window> public static readonly DependencyPr…