怎样才以使用户双击标题栏时,不改变窗体的大小(50分)

  • 主题发起人 主题发起人 青春无悔
  • 开始时间 开始时间

青春无悔

Unregistered / Unconfirmed
GUEST, unregistred user!
怎样才以使用户双击标题栏时,不改变窗体的大小。因为我要在按最大化,最小化按
钮时进行别的处理。
 
form的Align 设定为alClient
 
procedure WMNCHitTest(var Message: TWMNCHitTest); message WM_NCHITTEST;

WMNCHITTEST(var Message:TWMNCHITTEST)
begin
if Message.Result=htCaption
then Message.Result=htClient;
end;

试一下这样行不行,
 
不是,我是想移动的时候可以,但是双击的时候不行
 
你可以定义一下窗口的大小,然后在该窗口的FormCanResize事件中根据NewWidth,NewHeight的值的大小设置 Resize:=false 或true
保证你随便动不了窗口.
 
不是,我是想不同和显示器可以有相同的显示结果,
 
unit Unit1;

interface

uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs;

type
TForm1 = class(TForm)
private
{ Private declarations }
Procedure WMSysCommand(Var message : TMessage) ; Message WM_SYSCOMMAND ;
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.DFM}

Procedure TForm1.WMSysCommand(Var Message : TMessage) ;
begin

case Message.WParam of
61490: //使用户双击标题栏时,不改变窗体的大小
begin
exit;
end;
SC_MINIMIZE:
begin
ShowMessage('SC_MINIMIZE');
end;
SC_MAXIMIZE:
begin
ShowMessage('SC_MAXIMIZE');
end;
else
Inherited;
end; //end of case

end;

end.
 
看来我想了两天的问题好像是为你做的似的?你应该给我一点加班费才对。。。
请接招吧!
unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs;

type
TForm1 = class(TForm)
private
{ Private declarations }
public
procedure aa(var message:twmnclbuttondblclk); message wm_nclbuttondblclk;
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.dfm}

procedure tform1.aa(var message:twmnclbuttondblclk);
begin
if message.HitTest=htcaption then
begin
message.HitTest:=htclient;
end;
end;

end.
 
多人接受答案了。
 
分我都给你们了,这个问题到此为止
 
后退
顶部