在运行时能用鼠标拖动报表上的LABEL

在运行时能用鼠标拖动报表上的LABEL hlms Delphi 笔记 - delphi2007.net
http://www.delphi2007.net/delphiblog/html/delphi_2004992226395018.html
private

    { Private declarations }

    OriginalPos,DownPos,CurrentPos:TPoint;

    mousedown:boolean;//在CRETE中将它初始化为false

procedure TForm1.Label1MouseDown(Sender: TObject; Button: TMouseButton;

  Shift: TShiftState; X, Y: Integer);

begin

    OriginalPos.x:=Label1.Left;

     OriginalPos.y:=Label1.Top;

     DownPos.x:=X;

     DownPos.y:=Y;

     DownPos:=ClientToScreen(DownPos);

     if Button = mbLeft then

          MouseDown:=True;

end;



procedure TForm1.Label1MouseMove(Sender: TObject; Shift: TShiftState; X,

  Y: Integer);

begin

     if MouseDown then

     begin

          CurrentPos.x:=X;

          CurrentPos.y:=Y;

          CurrentPos:=ClientToScreen(CurrentPos);

          Label1.Left:=OriginalPos.X+CurrentPos.X-DownPos.X;

          Label1.Top :=OriginalPos.Y+CurrentPos.Y-DownPos.Y;

     end;

end;



procedure TForm1.Label1MouseUp(Sender: TObject; Button: TMouseButton;

  Shift: TShiftState; X, Y: Integer);

begin

  mousedown:=false;

end;
 

  • 正在考虑将博客出书的事,任何人可以将自己的博客出个十到一百本书,有意思
  • HOWTO track a user's idle time
  • 一处长十年玩弄上百名女性 留下无耻“性日记”
  • fastreport 报表模板制作 类似于水晶报表
  • Win2K下的Api函数的拦截
  • Timer in TThread
  • Additional Data within a StringList
  • Find all Local Computers on a LAN
  • Disable Ctrl Alt Del and Alt Tab
  • Hi / Lo order byte
  • 你可能感兴趣的:(label)