Take the 2-minute tour ×

I want to self-draw the caption bar of my application's window, so I decided to override OnNcPaint() methods. But I don't know how to set a different height of the caption bar. Everytime I use GetSystemMetrics(SM_CYCAPTION), it retruns the same value.

Can anyone tell me how to do it? Thank you!

share|improve this question

2 Answers 2

You can't change the size of a normal Windows-drawn caption bar. That's determined by the user settings and the theme. If you're drawing things yourself, then you also define the caption dimensions yourself. You can paint whatever you want wherever you want, so you can paint your caption bar over what would normally be considered the client area. To make that extra region behave as though it's really the caption bar, handle the wm_NCHitTest message and return htCaption.

Note that GetSystemMetrics does not accept a window handle as one of its parameters. That means that it cannot return window-specific metrics. As its name suggests, it gives you system-wide metrics.

share|improve this answer

Instead of messing with the Caption, don't use it at all. Instead, 'invent' your own caption. Set a TPanel to align to the top of your window and use it as a caption for that window.

share|improve this answer

Your Answer


