to 小笨苯:<br>http://www.delphibbs.com/delphibbs/dispq.asp?lid=1382432<br>我已经能用更好的办法了,如下:<br>unit Unit1;<br><br>interface<br><br>uses<br> Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,<br> Dialogs;<br><br>type<br> TForm1 = class(TForm)<br> procedure FormCanResize(Sender: TObject; var NewWidth,<br> NewHeight: Integer; var Resize: Boolean);<br> procedure FormCreate(Sender: TObject);<br> private<br> { Private declarations }<br> Ratio:Single;<br> procedure MyMouseDown(var msg:TMessage); message WM_NCHitTest;<br> public<br> { Public declarations }<br> end;<br><br>var<br> Form1: TForm1;<br><br>implementation<br><br>{$R *.dfm}<br><br>procedure MyMouseDown(var msg:TMessage);<br>begin<br> inherited;<br> if (msg.result>9)and(msg.result<18) then tag:=0;<br>end;<br><br>procedure TForm1.FormCanResize(Sender: TObject; var NewWidth,<br> NewHeight: Integer; var Resize: Boolean);<br>begin<br> if tag=0 then begin<br> if NewWidth<>Width then tag:=1;<br> if NewHeight<>Height then tag:=2;<br> end;<br> if tag=1 then NewHeight:=Round(NewWidth*Ratio);<br> if tag=2 then NewWidth:=Round(NewHeight/Ratio);<br>end;<br><br>procedure TForm1.FormCreate(Sender: TObject);<br>begin<br> Ratio:=0.8;<br>end;<br><br>end.<br><br>请您测试。<br>