最大化最小化自定义窗口的尺寸
2014-10-13 15:41
106 查看
unit uBaseForm;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs;
type
TPoint = record
x: Integer;
y: Integer;
end;
TMinMaxInfo = record
ptReserved: TPoint;
ptMaxSize: TPoint;
ptMaxPosition: TPoint;
ptMinTrackSize: TPoint;
ptMaxTrackSize: TPoint;
end;
TWMGetMinMaxInfo = record
Msg: Cardinal;
Unused: Integer;
MinMaxInfo: PMinMaxInfo;
Result: Longint;
end;
TBaseForm = class(TForm)
procedure FormClose(Sender: TObject; var Action: TCloseAction);
private
procedure WMGetMinMaxInfo(var Message: TWMGetMinMaxInfo ); message WM_GETMINMAXINFO;
end;
var
BaseForm: TBaseForm;
implementation
{$R *.dfm}
procedure TBaseForm.FormClose(Sender: TObject; var Action: TCloseAction);
begin
Action := caFree;
end;
procedure TBaseForm.WMGetMinMaxInfo(var Message: TWMGetMinMaxInfo);
begin
with Message.MinMaxInfo^ do
begin
//ptMaxSize.X := Screen.Width; {Width when maximized}
//ptMaxSize.Y := 200; {Height when maximized}
ptMaxPosition.X := 0; {Left position when maximized}
ptMaxPosition.Y := Application.MainForm.Height; {Top position when maximized}
//ptMinTrackSize.X := 100; {Minimum width}
//ptMinTrackSize.Y := 100; {Minimum height}
ptMaxTrackSize.X := Screen.Width; {Maximum width}
ptMaxTrackSize.Y := screen.Height - Application.MainForm.Height -25; {Maximum height}
end;
Message.Result := 0; {Tell windows you have changed minmaxinfo}
inherited;
end;
end.
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs;
type
TPoint = record
x: Integer;
y: Integer;
end;
TMinMaxInfo = record
ptReserved: TPoint;
ptMaxSize: TPoint;
ptMaxPosition: TPoint;
ptMinTrackSize: TPoint;
ptMaxTrackSize: TPoint;
end;
TWMGetMinMaxInfo = record
Msg: Cardinal;
Unused: Integer;
MinMaxInfo: PMinMaxInfo;
Result: Longint;
end;
TBaseForm = class(TForm)
procedure FormClose(Sender: TObject; var Action: TCloseAction);
private
procedure WMGetMinMaxInfo(var Message: TWMGetMinMaxInfo ); message WM_GETMINMAXINFO;
end;
var
BaseForm: TBaseForm;
implementation
{$R *.dfm}
procedure TBaseForm.FormClose(Sender: TObject; var Action: TCloseAction);
begin
Action := caFree;
end;
procedure TBaseForm.WMGetMinMaxInfo(var Message: TWMGetMinMaxInfo);
begin
with Message.MinMaxInfo^ do
begin
//ptMaxSize.X := Screen.Width; {Width when maximized}
//ptMaxSize.Y := 200; {Height when maximized}
ptMaxPosition.X := 0; {Left position when maximized}
ptMaxPosition.Y := Application.MainForm.Height; {Top position when maximized}
//ptMinTrackSize.X := 100; {Minimum width}
//ptMinTrackSize.Y := 100; {Minimum height}
ptMaxTrackSize.X := Screen.Width; {Maximum width}
ptMaxTrackSize.Y := screen.Height - Application.MainForm.Height -25; {Maximum height}
end;
Message.Result := 0; {Tell windows you have changed minmaxinfo}
inherited;
end;
end.
相关文章推荐
- 最大化最小化自定义窗口的尺寸
- 【Qt】自定义标题栏并实现最小化/最大化/关闭窗口功能
- iPhone手机解锁效果&&自定义滚动条&&拖拽--Clone&&窗口拖拽(改变大小/最小化/最大化/还原/关闭)
- 窗口右下角弹出信息(二)最大化、最小化、关闭
- Qt 设置窗口的最小化、最大化、关闭按钮
- Ubuntu 11.04修改窗口最小化,最大化,关闭按钮的位置
- 一个SWT应用程序窗口最大化最小化问题?
- 重载 CreateParams 方法[1]: 从一个例子开始(取消窗口最大化、最小化按钮的三种方法)
- Qt自定义窗口(有最大最小化窗口,关闭窗口)
- 如何让窗口和 MDI窗口一启动就最大化和最小化?
- 最大化、最小化窗口
- net实现窗口最大化和最小化以解关闭(转)
- 怎样避免 MDI 子窗口在最大化(或最小化)过程中出现闪烁
- C#隐藏其他程序窗口以及添加最小化/最大化按钮
- 获取一个窗口的状态(最小化、最大化)
- Q窗口操作函数(窗口最大化,全屏,隐藏最大化最小化按钮)
- PyQt:无边框自定义标题栏及最大化最小化窗体大小调整
- MFC去掉窗口右上方最大化最小化关闭按钮
- 让IE窗口最小化最大化的快捷键
- wpf 自定义窗口,最大化时不覆盖任务栏