我的目的主要是为了把鼠标移动到当前cell那里,我使用Dbgrideh的OnDrawColumnCell事件,却发现不能很好的定位,因为通常我编辑当前cell的时候会触发其他cell作相应的变化

解决方案 »

  1.   

    下个第三方控件 EHlib 就能解决所有问题
    www.51delphi.com
      

  2.   

    是不是这样效果?procedure TForm1.DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect;
      DataCol: Integer; Column: TColumn; State: TGridDrawState);
    var
      p: TPoint;
    begin
      if gdSelected in State then
      begin
        p := DBGrid1.ClientToScreen(Point(Rect.Left, Rect.Top));
        SetCursorPos(p.X, p.Y);
      end;
    end;