I want to put components at the top of the form in the border like in this screenshot.
I got in my project a TPageControl
and i want to move it to the top in the border. How can i do this?
I want to put components at the top of the form in the border like in this screenshot.
I got in my project a TPageControl
and i want to move it to the top in the border. How can i do this?
It should be noted that Microsoft highly suggests against doing such a thing. That said, keep in mind that the design of a window literally counter-indicates putting any kind of "control" in the non-client area. That said, you can see pretty readily by looking at the code posted here in terms of the events. You literally have to account for your new "control" by painting it yourself and then intercepting the "special" controls via all the non-client area messages.
TTitleBtnForm = class(TForm)
procedure FormResize(Sender: TObject);
private
TitleButton : TRect;
procedure DrawTitleButton;
{Paint-related messages}
procedure WMSetText(var Msg : TWMSetText); message WM_SETTEXT;
procedure WMNCPaint(var Msg : TWMNCPaint); message WM_NCPAINT;
procedure WMNCActivate(var Msg : TWMNCActivate); message WM_NCACTIVATE;
{Mouse down-related messages}
procedure WMNCHitTest(var Msg : TWMNCHitTest); message WM_NCHITTEST;
procedure WMNCLButtonDown(var Msg : TWMNCLButtonDown); message WM_NCLBUTTONDOWN;
function GetVerInfo : DWORD;
end;
I won't do a disservice to the person who owns the content of the site by posting the whole thing, but you'll get the idea pretty quickly that it's not wise to mess with the non-client area.
On the other hand, keep in mind that all the examples you posted are skinned windows, which means the standard window was reframed with new controls indicating what you want. In that case, you can do whatever you want, as long as you provide all the expected functionality. You start by setting the BorderStyle to bsNone and then shimming your controls out to the dimensions of your form so you don't see awkward gaps. Here's a very quick example I did. Of course, you change colors and add close/minimize/maximize buttons and whatever you like.
Hope that all helps.