我做了个无窗口的form
在里面放了一个图片
如何使得拖动图片窗口跟着移动啊?
我看过一些例子都是在窗口任何位置拖动鼠标的代码
procedure TForm1.WMNCHitTest(var M: TWMNCHitTest);
begin
  inherited;
  if M.Result = htClient then
  M.Result := htCaption;
end; 
不知道要怎样修改

解决方案 »

  1.   

    他们都不会,我也不回。你知道了给我发个Email:[email protected]
      

  2.   

    ...
      private
        { Private declarations }
        procedure WMNCHitTest(var M: TWMNCHitTest);message WM_NCHITTEST;
    ...
    procedure TForm1.WMNCHitTest(var M: TWMNCHitTest);
    begin
      inherited;
      if M.Result = htClient then
        M.Result := htCaption;
    end;
    ...
      

  3.   

    在图片的onmousemove 里处理
      

  4.   


    FormMouseDown事件
    const
      SC_DragMove = $F012;  { a magic number }
    begin
      if button = mbRight then
        Close
      else
      begin   //左键拖动
        ReleaseCapture;
        Form1.perform(WM_SysCommand, SC_DragMove, 0);
      end;
      

  5.   

    方法2:
    procedure TForm1.Image1MouseDown(Sender: TObject; Button: TMouseButton;
      Shift: TShiftState; X, Y: Integer);
    begin
      ReleaseCapture;
      Perform(WM_syscommand,$F012,0);
    end;
      

  6.   

    其实真的用不着这样, 不是有现成的OnMouseMove和OnMouseDown吗?