开发者

Using Microsoft Windows Standard Style in WPF-Window?

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜