forked from gitextensions/gitextensions
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFontUtil.cs
37 lines (30 loc) · 1.25 KB
/
FontUtil.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
namespace GitUI
{
using System;
using System.Drawing;
public static class FontUtil
{
#pragma warning disable SA1305 // Field names should not use Hungarian notation
static FontUtil()
{
var hTheme = NativeMethods.OpenThemeData(IntPtr.Zero, "TEXTSTYLE");
if (hTheme != IntPtr.Zero)
{
NativeMethods.GetThemeFont(hTheme, IntPtr.Zero, NativeMethods.TEXT_MAININSTRUCTION, 0, NativeMethods.TMT_FONT, out var pFont);
MainInstructionFont = Font.FromLogFont(pFont);
NativeMethods.COLORREF pColor;
NativeMethods.GetThemeColor(hTheme, NativeMethods.TEXT_MAININSTRUCTION, 0, NativeMethods.TMT_TEXTCOLOR, out pColor);
MainInstructionColor = Color.FromArgb(pColor.R, pColor.G, pColor.B);
NativeMethods.CloseThemeData(hTheme);
}
else
{
MainInstructionFont = SystemFonts.CaptionFont;
MainInstructionColor = SystemColors.WindowText;
}
}
#pragma warning restore SA1305 // Field names should not use Hungarian notation
public static Font MainInstructionFont { get; }
public static Color MainInstructionColor { get; }
}
}