tags:

views:

533

answers:

3

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!

+1  A: 

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.

Rob Kennedy
A: 

You can't change the size of a normal Windows-drawn caption bar.

Of course you can ! see g.g.

I don't see. Show me the link.
Rob Kennedy
A: 

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.

Altar