最大化最小化自定义窗口的尺寸
2011-09-28 21:46
477 查看
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.
相关文章推荐
- 最大化最小化自定义窗口的尺寸
- iPhone手机解锁效果&&自定义滚动条&&拖拽--Clone&&窗口拖拽(改变大小/最小化/最大化/还原/关闭)
- 【Qt】自定义标题栏并实现最小化/最大化/关闭窗口功能
- WinAPI: IsIconic、IsZoomed - 分别判断窗口是否已最小化、最大化
- 最大化/最小化/关闭窗口代码集锦收藏
- delphi代码实现窗口最小化,最大化,关闭消息发送
- 修改Ubuntu窗口最小化,最大化,关闭按钮的位置
- Flex 窗口最小化,最大化,拖动
- 如何重载最小化、最大化窗口消息响应
- VC 使窗口的最大最小化按钮失效,无法改变视窗尺寸。
- 修复金山词霸只有最大化和最小化两种窗口状态的问题
- Rhyme/ win10 窗口最大最小化,向左向右最大化快捷键
- WPF窗口的关闭、最大化、最小化、拖动事件
- Qt之自定义界面添加最小化、最大化和关闭按钮
- MDI设计中,子窗口的不同显示方式(最大化显示,普通显示,最小化显示)
- 窗口最大化、最小化以及全屏显示
- electron 的窗口设置最大化 最小化
- 网页窗口拖拽(改变大小/最小化/最大化/还原/关闭)
- 如何判断窗口是在最小化或者最大化的状态
- 用div实现弹出窗口,拖动,最大化,最小化,关闭