How to determine thickness of the title bar?
Posted on 2003-11-16
My application uses a bmp interface pasted on a pictureBox control and has an irregular shape, so I use the CreateEllipticRgn API call to give the window a special shape. But the problem I have lies in the difference of thickness of the title bar in various situations:
- WinXP: the title bar is a bit thicker than the one in previous Win versions
- with DPI settings higher than 96dpi, the title bar is also thicker.
while normally, all controls are positioned on the form relative to the title bar's thickness, the CreateEllipticRgn API call calculates positions from the very top of the very window... regardless of the title bar's thickness. So if I set it right for WinXP, the graphic seems off by a few pixels vertically in other windows versions.
So I really just need to know the thickness of the title bar at run time in a given window -- or, alternatively, I need any way to determine, at run time, the position of a control relative to the very top of the window, not the end of the title bar... so I can therefore deduct the position of the rest, thus the thickness of the title bar (but again, the problem is the 0 position for controls begins after the title bar...)
Thanks in advance