我没太听懂你的意思,能举例说明吗?
在demo中richedit有个移动标尺的例子,按label.mousemove搜一下可找到。
有个Fdraging:=True时可移动。

解决方案 »

  1.   

    贴一段程序给你看看,我是用来改变颜色的.你可以自己改改var
      g_OldControl: TControl;procedure TForm1.MyOnMessage(var Msg: TMsg; var Handled: Boolean);
    var
      l_lpPos: TPoint;
      l_CurControl: TControl;
    begin
      Handled := True;
      if  Msg.message = WM_MOUSEMOVE then
      begin
        GetCursorPos(l_lpPos);
        l_CurControl := ControlAtPos(Self.ScreenToClient(l_lpPos), False, True);
        if (l_CurControl = g_OldControl) then Exit;
        if g_OldControl is TLabel then
            (g_OldControl as TLabel).Font.Color := clWindowText;
        if l_CurControl is TLabel then
        begin
          (l_CurControl as TLabel).Font.Color := clRed;
        end ;
        g_OldCOntrol := l_CurControl;
      end
      else
        Handled := False;
    end;
    procedure TForm1.FormCreate(Sender: TObject);
    begin
      Application.OnMessage := MyOnMessage;
    end;