我的代码如下:
procedure TForm1.FormMouseMove(Sender: TObject; Shift: TShiftState; X,
  Y: Integer);
begin
 ReleaseCapture;
 sendmessage(Handle,wm_syscommand,SC_SIZE,0);
end;
但不起作用。

解决方案 »

  1.   

    procedure TForm1.FormMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
    begin
    if (ssLeft in Shift) then begin
    ReleaseCapture;
    SendMessage(Form1.Handle,WM_SYSCOMMAND,SC_MOVE+1,0);
    end;
    end;
      

  2.   

    to fengron(丰臣) :
      不行啊,这个只能移动窗体。我是要改变窗体大小。
      

  3.   

    MoveWindow(Form1.Handle, 0, 0, Form1.Width+120, Form1.Height+100,True);
      

  4.   

    procedure TzypNeoForm.WMNCHitTest(var Msg:TWMNCHitTest);
    var
      pt:TPoint;
    begin
    if (GetCanReSize=False) or (WindowState<>wsNormal) then
      begin
      inherited;
      exit;
      end;
    pt:=Point(Msg.xPos,Msg.yPos);
    pt:=ScreenToClient(pt);
    if (pt.x<5) and (pt.y<5) then Msg.Result:=htTopLeft
    else if (pt.x>width-5) and (pt.y<5) then Msg.Result:=htTopRight
    else if (pt.x>width-5) and (pt.y>height-5) then Msg.Result:=htBottomRight
    else if (pt.x<5) and (pt.y>height-5) then Msg.Result:=htBottomLeft
    else if (pt.x<5) then Msg.Result:=htLeft
    else if (pt.y<5) then Msg.Result:=htTop
    else if (pt.x>width-5) then Msg.Result:=htRight
    else if (pt.y>height-5) then Msg.Result:=htBottom
    else inherited;
    end;
    好像可以这样的
      

  5.   

    // 对指定窗体设置属性
      SetWindowLong(Handle,                   // 当前窗体句柄
                    GWL_STYLE,                // 表示当前是要设置新的窗体(普通)样式
                    // 得到指定窗体信息
                    GetWindowLong(Handle, GWL_STYLE)
                      and (not WS_CAPTION));  // 去掉样式(s)中的“标题”样式
      

  6.   

    你差一点就对了,几百年没有搞过这些小Tip了,还记得点,呵呵~~~~~~~
    procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton;
      Shift: TShiftState; X, Y: Integer);
    begin
      if Button = mbLeft then
      begin
        ReleaseCapture;
        SendMessage(Handle, WM_SYSCOMMAND, $F012, 0)
      end;
    end;
      

  7.   

    搞错,以上是移动,抄以前一位仁兄的代码了,是谁我记不到了。要在MouseMove中写代码
    procedure ManipulateControl(Control: TControl; Shift: TShiftState; X, Y, Precision: integer);
    var SC_MANIPULATE: Word;
    begin
      //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      //光标在控件的最左侧**********************************************************
      //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           if (X<=Precision) and (Y>Precision) and (Y<Control.Height-Precision)
      then begin
             SC_MANIPULATE  := $F001;
             Control.Cursor := crSizeWE;
           end
      //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      //光标在控件的最右侧**********************************************************
      //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      else if (X>=Control.Width-Precision) and (Y>Precision) and (Y<Control.Height-Precision)
      then begin
             SC_MANIPULATE  := $F002;
             Control.Cursor := crSizeWE;
           end
      //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      //光标在控件的最上侧**********************************************************
      //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      else if (X>Precision) and (X<Control.Width-Precision) and (Y<=Precision)
      then begin
             SC_MANIPULATE  := $F003;
             Control.Cursor := crSizeNS;
           end
      //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      //光标在控件的左上角**********************************************************
      //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      else if (X<=Precision) and (Y<=Precision)
      then begin
             SC_MANIPULATE  := $F004;
             Control.Cursor := crSizeNWSE;
           end
      //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      //光标在控件的右上角**********************************************************
      //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      else if (X>=Control.Width-Precision) and (Y<=Precision)
      then begin
             SC_MANIPULATE  := $F005;
             Control.Cursor := crSizeNESW    ;
           end
      //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      //光标在控件的最下侧**********************************************************
      //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      else if (X>Precision) and (X<Control.Width-Precision) and (Y>=Control.Height-Precision)
      then begin
             SC_MANIPULATE  := $F006;
             Control.Cursor := crSizeNS;
           end
      //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      //光标在控件的左下角**********************************************************
      //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      else if (X<=Precision) and (Y>=Control.Height-Precision)
      then begin
             SC_MANIPULATE  := $F007;
             Control.Cursor := crSizeNESW;
           end
      //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      //光标在控件的右下角**********************************************************
      //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      else if (X>=Control.Width-Precision) and (Y>=Control.Height-Precision)
      then begin
             SC_MANIPULATE  := $F008;
             Control.Cursor := crSizeNWSE;
           end
      //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      //光标在控件的客户区(移动整个控件)******************************************
      //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      else if (X>5) and (Y>5) and (X<Control.Width-5) and (Y<Control.Height-5)
      then begin
             SC_MANIPULATE  := $F009;
             Control.Cursor := crSizeAll;
           end
      else begin
             SC_MANIPULATE := $F000;
             Control.Cursor := crDefault;
           end;
      //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      if Shift=[ssLeft] then
      begin
        ReleaseCapture;
        Control.Perform(WM_SYSCOMMAND, SC_MANIPULATE, 0);
      end;
    end;procedure TForm1.FormMouseMove(Sender: TObject; Shift: TShiftState; X,
      Y: Integer);
    begin
      ReleaseCapture;
      ManipulateControl(Self, Shift, X, Y, 10);
    end;