如何在WPF中更改窗口的字体,除了创建窗口模板并使用它之外还有什么其他方法吗?
我通常在Application.Resources中使用这个:
<Style TargetType="{x:Type Window}">
<Setter Property="FontFamily"
Value="Cambria" />
</Style>
Style = (Style)FindResource(typeof(Window));
Application.Current.MainWindow.FontFamily = new FontFamily("Cambria");
注意:对于第二种方法,您不再需要那个样式。
编辑1
很遗憾我没有完全关注您的问题。确实没有一种简单的方法来完成这个任务。我不知道您到目前为止找到或完成了什么,但我曾经使用过 这个项目 ,它表现良好。
另一个例子是这个。我没有尝试过,但看起来很有前途: WPF自定义Chrome库
确实需要大量工作。
来自MSDN:
The non-client area of a window is implemented by WPF and includes the parts of a window that are common to most windows, including the following:
A border. A title bar. An icon. Minimize, Maximize, and Restore buttons. A Close button. A System menu with menu items that allow users to minimize, maximize, restore, move, resize, and close a window.
而那些“非客户端”区域则由窗口控制。