zoukankan      html  css  js  c++  java
  • 限制窗体的大小

    重载 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消息在窗体改变大小或位置时候发送到窗口,应用程序可以改写其中的窗体
    的大小和位置。

    消息结构定义如下:

    LRESULT CALLBACK WindowProc(
    HWND hwnd, // handle to window
    UINT uMsg, // WM_GETMINMAXINFO
    WPARAM wParam, // not used
    LPARAM lParam // window information (LPMINMAXINFO)
    );

    第二个参数就是本消息的ID值。
    最后一个参数是指向 MINMAXINFO 结构体指针。此结构定义如下:

    typedef struct tagMINMAXINFO {
    POINT ptReserved;
    POINT ptMaxSize;
    POINT ptMaxPosition;
    POINT ptMinTrackSize;
    POINT ptMaxTrackSize;
    } MINMAXINFO;

      ptReserved:
      保留项目,目前没有使用。

      ptMaxSize:
      指定窗体的最大高度(point.x)和宽度(point.y)。在多监视器的系统中,设定运用于主监视器上。

      ptMaxPosition:
    指定最大化状态的窗体的左边的位置 (point.x) 和最大化窗体定边的位置 (point.y)。 在多监
    视器系统中,设定运用于主监视器。

      ptMinTrackSize:
      指定窗体框架最小宽度下限 (point.x) 和最小高度下限 (point.y) 。 在多监视器系统中,不会
    有所变化。

      ptMaxTrackSize:
      指定窗体框架最小宽度下限 (point.x) 和最小高度下限 (point.y) 在多监视器系统中,大小和
    监视器中最大的值一样。

    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 is maximized or resized, this refers to the primary monitor.
    ptMaxPosition Refers to the monitor that the window will maximize on, not the desktop.
    ptMinTrackSize Unchanged.
    ptMaxTrackSize Size for a window that is 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 will maximize to the size of the larger monitor.

    Requirements
    Windows NT/2000/XP: Included in Windows NT 3.1 and later.
    Windows 95/98/Me: Included in Windows 95 and later.
    Header: Declared in Winuser.h; include Windows.h.

  • 相关阅读:
    python3--函数(函数,全局变量和局部变量,递归函数)
    Acunetix Web Vulnarability Scanner V10.5 详细中文手册
    Splunk学习与实践
    Visual studio code离线安装插件
    calling c++ from golang with swig--windows dll(一)
    Golang版protobuf编译
    大型网站架构系列:负载均衡详解(3)
    大型网站架构系列:负载均衡详解(2)
    大型网站架构系列:负载均衡详解(1)
    大型网站架构系列:分布式消息队列(二)
  • 原文地址:https://www.cnblogs.com/spiritofcloud/p/3978316.html
Copyright © 2011-2022 走看看