0

当我右键单击 DBGrid 时,它会打开一个弹出菜单,但它也会在右键单击时选择(突出显示)我当前所在的单元格。

有没有办法在右键单击时不选择(突出显示)我结束的单元格并且只打开弹出菜单?

最好的问候约瑟夫

4

1 回答 1

1

You might intercept WM_RButtonDown for your DBGrid using an interposer class or an own derivied component.
An example could look like:

type
  TDBGrid=Class(VDBGrids.TDBGrid)
    Procedure WMRButtonDown(var Msg:TMessage);Message  WM_RButtonDown;
  End;

  TForm3 = class(TForm)
    ........

implementation

{$R *.dfm}

{ TDBGrid }

procedure TDBGrid.WMRButtonDown(var Msg: TMessage);
begin
   if Tag = 123 then  // abuse the tag or implement an own property to handle only wished grid
      Msg.Result := 0
   else inherited;
end;
于 2013-12-10T09:43:37.270 回答