Limit the size of a form

Source: Internet
Author: User

Message handler functions in overloaded Tcustomform
Procedure Wmgetminmaxinfo (var message:twmgetminmaxinfo); Message wm_getminmaxinfo;

Procedure Tbrxserverform.wmgetminmaxinfo (var message:twmgetminmaxinfo);
Begin
inherited;
With message.minmaxinfo^ do
Begin
Ptmintracksize.x: = 640;
PTMINTRACKSIZE.Y: = 480;
End
End

Wm_getminmaxinfo messages are sent to a window when the form changes size or position, the application can overwrite the form in it
The size and position of the.

The message structure is defined as follows:

LRESULT CALLBACK WindowProc (
HWND hwnd,//Handle to Window
UINT umsg,//Wm_getminmaxinfo
WPARAM WPARAM,//Not used
LPARAM LPARAM//Window information (lpminmaxinfo)
);

The second parameter is the ID value of this message.
The last parameter is the pointer to the Minmaxinfo struct. This structure is defined as follows:

typedef struct TAGMINMAXINFO {
Point ptreserved;
Point Ptmaxsize;
Point Ptmaxposition;
Point ptMinTrackSize;
Point ptMaxTrackSize;
} minmaxinfo;

Ptreserved:
Reserved items, not currently used.

Ptmaxsize:
Specifies the maximum height (point.x) and width (point.y) of the form. In a multi-monitor system, the settings are applied to the primary monitor.

Ptmaxposition:
Specifies the position of the left side of the form that maximizes the state (point.x) and the position of the maximized form Dingbian (POINT.Y). In the multi-monitor
System, the settings are applied to the primary monitor.

ptMinTrackSize:
Specifies the minimum width lower limit (point.x) and minimum height (point.y) of the form frame. In a multi-monitor system, no
have been changed.

ptMaxTrackSize:
Specifies the minimum width lower limit (point.x) and minimum height (point.y) of the form frame in a multi-monitor system, the size and
The largest value in the monitor.

Remarks
The following table describes the changes that occur for a system with multiple monitors.

Minmaxinfo member Definition for multiple monitors
Ptmaxsize when a window was maximized or resized, this refers to the primary monitor.
Ptmaxposition refers to the monitor, the window would maximize on, not the desktop.
ptMinTrackSize unchanged.
ptMaxTrackSize Size for a window, made as large as the virtual screen.


The system automatically compensates for differences between the primary monitor and the monitor of the window. Thus, if the user leaves ptmaxsize untouched, a window on a monitor larger than the primary monitor would maximize to the S Ize of the larger monitor.

Requirements
Windows nt/2000/xp:included in Windows NT 3.1 and later.
Windows 95/98/me:included in Windows later and.
Header:declared in Winuser.h; Include Windows.h.

Limit the size of a form

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.