开发者

Using Microsoft Windows Standard Style in WPF-Window?

开发者 https://www.devze.com 2022-12-17 01:00 出处:网络
Is it posible to use the Microsoft Wind开发者_高级运维ows Standard Style in a WPF-window? If I create a normal WPF-Window with a textblock or something like that, the font is very small and not the sa

Is it posible to use the Microsoft Wind开发者_高级运维ows Standard Style in a WPF-window? If I create a normal WPF-Window with a textblock or something like that, the font is very small and not the same like in Microsoft Windows. The background of the window is white. Maybe you can tell me how to use the Style or an information source or things like that, where I can read the settings of a Microsoft Windows Standard window, like:

  • Font Family/Size
  • Margins (In Buttons, windows, groupboxes,..)
  • Paddings
  • Colors (Backgroundcolor,..)
  • etc..


If you are looking for the system defined values for your application, have a look at these 3 classes :

  • System.Windows.SystemFonts
  • System.Windows.SystemParameters
  • System.Windows.SystemColors

Example (from MSDN):

Button btncsharp = new Button();
btncsharp.Content = "SystemFonts";
btncsharp.Background = SystemColors.ControlDarkDarkBrush;
btncsharp.FontSize = SystemFonts.IconFontSize;
btncsharp.FontWeight = SystemFonts.MessageFontWeight;
btncsharp.FontFamily = SystemFonts.CaptionFontFamily;
cv1.Children.Add(btncsharp);

OR, in XAML:

<Button
     FontSize="{x:Static SystemFonts.IconFontSize}"
     FontWeight="{x:Static SystemFonts.MessageFontWeight}"
     FontFamily="{x:Static SystemFonts.CaptionFontFamily}"
     Background="{x:Static SystemColors.HighlightBrush}">
     SystemFonts 
</Button>

Check these links at MSDN for more : System.Windows.SystemFonts, System.Windows.SystemParameters, and System.Windows.SystemColors

Quick Tip : Use Visual Studio IntelliSence to see a list of properties in these class

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号