unit Unit1;interfaceuses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;type
  TForm1 = class(TForm)
    Button1: TButton;
    procedure Button1MouseMove(Sender: TObject; Shift: TShiftState; X,
      Y: Integer);
  private
    { Private declarations }
  public
    { Public declarations }
  end;var
  Form1: TForm1;implementation{$R *.dfm}procedure TForm1.Button1MouseMove(Sender: TObject; Shift: TShiftState; X,
  Y: Integer);
begin
  if ssLeft in Shift then
  begin
    ReleaseCapture;
    (Sender as TControl).Perform(WM_SYSCOMMAND, $F007, 0);
  end;
end;end.

解决方案 »

  1.   

    procedure DragControl(WinControl: TWincontrol);
    const SC_DRAGMOVE = $F001;
    begin
      ReleaseCapture;
      WinControl.Perform(WM_SYSCOMMAND, SC_DRAGMOVE, 0);
    end;
      

  2.   

    用在button上可以,但我用在image上就不行了。
    怎么回事?????????
      

  3.   

    因为button是个窗口控件,又hwnd的,但image就没了。
      

  4.   

    button是TWincontrol的子类,但image不是