http://www.vchelp.net/source/resizable_dialog_demo.zip

解决方案 »

  1.   

    //放一个Panel,模拟标题
    unit Unit1;interfaceuses
      Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
      ExtCtrls;type
      TForm1 = class(TForm)
        Panel1: TPanel;
        procedure Panel1MouseDown(Sender: TObject; Button: TMouseButton;
          Shift: TShiftState; X, Y: Integer);
        procedure Panel1DblClick(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;var
      Form1: TForm1;implementation{$R *.DFM}procedure TForm1.Panel1MouseDown(Sender: TObject; Button: TMouseButton;
      Shift: TShiftState; X, Y: Integer);
    begin
      ReleaseCapture;
      Perform(WM_SYSCOMMAND,$F012,0);
    end;procedure TForm1.Panel1DblClick(Sender: TObject);
    begin
      if Form1.WindowState = wsNormal then
        Form1.WindowState := wsMaximized
      else
        Form1.WindowState := wsNormal;
    end;end.
      

  2.   

    usesWindows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,StdCtrls;
    typeTForm1 = class(TForm)privateprocedure WmNCHitTest(var Msg : TWMNCHitTest); message WM_NCHITTEST;
    { Private declarations }public{ Public declarations }end;
    varForm1: TForm1;
    implementation
    {$R *.DFM}
    procedure TForm1.WmNCHitTest(var Msg: TWMNCHitTest);const v=10; //border widthvar p:TPoint;beginp:=Point(Msg.XPos,Msg.YPos);p:=ScreenToClient(p);if PtInRect(Rect(0,0,v,v),p) thenMsg.Result:=HTTOPLEFTelse if PtInRect(Rect(Width-v,Height-v,Width,Height),p) thenMsg.Result:=HTBOTTOMRIGHTelse if PtInRect(Rect(Width-v,0,Width,v),p) thenMsg.Result:=HTTOPRIGHTelse if PtInRect(Rect(0,Height-v,v,Height),p) thenMsg.Result:=HTBOTTOMLEFTelse if PtInRect(Rect(v,0,Width-v,v),p) thenMsg.Result:=HTTOPelse if PtInRect(Rect(0,v,v,Height-v),p) thenMsg.Result:=HTLEFTelse if PtInRect(Rect(Width-v,v,Width,Height-v),p) thenMsg.Result:=HTRIGHTelse if PtInRect(Rect(v,Height-v,Width-v,Height),p) thenMsg.Result:=HTBOTTOM;Inherited;end;
    end.