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)

Source: Internet
Author: User

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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.