Author: Tomas Rutkauskas
Is it possible to define (set the size and position) of a window's client area
(without resizing the window itself)? What I want to do is increase the non-client
area to get more space to paint my own custom borders around a window. I want this
to be reflected to the client area so that my border is protected from anything
that goes on in the client area (painting, scrolling etc.).
You have to handle the WM_NCCALCSIZE message on your form. See win32.hlp for
details. The following example handler for a TListBox descendent excludes some
space for a header bar from the listboxes client area:
1 2 procedure THeaderListbox.wmnccalcsize(var msg: TWMNCCALCSIZE);
3 begin4 inherited;
5 if msg.CalcValidRects then6 with msg.CalcSize_Params^.rgrc do7 top := top + Itemheight + 4;
I hope you know how to define a message handler in the class declaration.