NoBrassRing NoBrassRing - 1 year ago 106
C# Question

C# - How to Determine a Form's Title bar font?

I want to create a form that is wide enough to show the title bar string, which is dynamic. To compute the string's text width, I need to know the title bar font. How do I query it?

Answer Source

You can use SystemFonts.CaptionFont property:

Gets a Font that is used to display text in the title bars of windows.

Sample usage:

using System.Drawing;

var font = SystemFonts.CaptionFont;
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download