Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get the title bar height and width for aero and basic design

Tags:

winapi

I am using GetSystemMetrics(SM_CXSIZEFRAME) for the width of the border, it works with the basic design, but not with aero, how can I improve it, so it works with aero?

I am using GetSystemMetrics(SM_CYCAPTION) for the height of the title bar but the value is too small for both, basic and aero design, what am I doing wrong here?

like image 887
Alph0r Avatar asked Feb 05 '14 00:02

Alph0r


People also ask

How tall is the title bar?

The title bar has a default height of 25 pixels, and can be set to any greater value up to 50 pixels.

How do I change the size of my title bar?

The title bar font can be changed here: control panel > display settings. or: Windows settings > system > advanced display settings > change the size of text and other elements.

Where is the title bar in Windows 10?

At the top of every window is the title bar, which displays the name of the application. It also has buttons that are clicked to minimize and restore the window and exit the application (see Win Minimize windows).


1 Answers

In unthemed Windows, GetSystemMetrics(SM_CYCAPTION) is the height of the text in the title bar; you need to add in the size of the frame and border padding (GetSystemMetrics(SM_CYSIZEFRAME) + GetSystemMetrics(SM_CYEDGE) * 2).

For themed Windows (which is the default these days), GetThemeSysSize is most likely the function you're looking for; in particular, GetThemeSysSize(SM_CXBORDER) for the border width, and GetThemeSysSize(SM_CYSIZE) + GetThemeSysSize(SM_CXPADDEDBORDER) * 2 for the title bar.

like image 173
Eric Brown Avatar answered Sep 28 '22 07:09

Eric Brown