原理是得到鼠标双击标题栏的消息,然后把这个消息置零,代码如下,非常有效: public procedure WMSysCommand(var msg:TWMSysCommand); message WM_SysCommand; ///////////////////////////////////////////// procedure TForm1.WMSysCommand(var msg:TWMSysCommand); begin if (msg.CmdType=61730) or (msg.CmdType=61728) or (msg.CmdType=WM_NCHITTEST) then msg.Result:=0 else inherited; end;
BorderStyle := bsToolWindow;//No.2
Constraints.MaxHeight := Height;
Constraints.MinHeight := Height;
Constraints.MaxWidth := Width;
Constraints.MinWidth := Width;
BorderStyle := bsSingle; //也可以
left:=10;
top:=10;
width:=600;
height:=400;
并且将Form的拨BorderIcons的biMaximize设置为False;
我让你变
public
procedure WMSysCommand(var msg:TWMSysCommand);
message WM_SysCommand;
/////////////////////////////////////////////
procedure TForm1.WMSysCommand(var msg:TWMSysCommand);
begin
if (msg.CmdType=61730) or (msg.CmdType=61728) or (msg.CmdType=WM_NCHITTEST) then msg.Result:=0
else inherited;
end;
BorderStyle:=bsDialog
BorderStyle := bsSingle或FormCanResize中改变大小,既可以固定窗体也可以让窗体在一定范围内改变!