First, when creating a Window object, CreateWindowEx can specify the position of the window. In addition, there are three ways to change the position of the window:
procedureTwincontrol.createwindowhandle (Constparams:tcreateparams);begin //use the API to create a window based on the params parameters that were previously prepared. Its 10 parameters are params parameters, 0 means that the Menu,windowclass 10 items only use hinstance one //The important control moves to the correct display position, which is by this x and Y, which moves to the relative position of the parent control area (practice detection). and VC in general use Cw_usedefault withParams DoFhandle:= CreateWindowEx (ExStyle, Winclassname, Caption, Style, X, Y, Width, Height, Wndparent,0, Windowclass.hinstance, Param); //API, a total of 12 parameters, note that CreateWindowEx than CreateWindow one parameter: Dwexstle (Delphi doesn't use CreateWindow) //The first 9 parameters are tcreateparams parameters, //the 10th parameter is a menu //The 11th parameter indicates which hinstance the newly created window belongs to . //the 12th parameter cannot be usedEnd;
--------------------------------------------------------------------
The first way to change the coordinates of the Windows window (most useful because it has many useful flag bits):
0, Aleft, ATop, Awidth, aheight, Swp_nozorder + swp_noactivate);
The second way to change the coordinates of the Windows window (Pro-Test):
procedureTform1.button2click (sender:tobject);varwindowplacement:twindowplacement;//Windows fabric type, containing 6 items, such as maximizing minimized window positionbeginwindowplacement.length:=SizeOf (windowplacement); GetWindowPlacement (Panel1.handle, @WindowPlacement); //API, get struct pointer, including 7 items //Change the location information for a windowWindowplacement.rcnormalposition: =Panel1.boundsrect; WindowPlacement.rcNormalPosition.Left:= WindowPlacement.rcNormalPosition.Left-Ten; WindowPlacement.rcNormalPosition.Right:= WindowPlacement.rcNormalPosition.Right-Ten; SetWindowPlacement (Panel1.handle, @WindowPlacement);End;
The third way to change the coordinates of the Windows window (Pro-Test):
Ten Ten - , True);
--------------------------------------------------------------------
In addition, SetScrollPos also has some relevant role, worth studying
In addition to specifying the window position at creation time, there are 3 ways to move the window position (it is often possible to change the window size while moving) (SetWindowPos is most useful, it has many flag bits)