A
anags
Unregistered / Unconfirmed
GUEST, unregistred user!
我想判断双击是表头还是表体,但无法实现。代码如下:请各位老大赐教。
procedure TfrmStockSQL.DBGridEh1DblClick(Sender: TObject);
var
//ARect: TRect;
Cell: TGridCoord ;
Button: TMouseButton;
Shift: TShiftState;
X, Y: Integer ;
begin
MouseUp(Button, Shift, X, Y);
//X:=ScreenToClient(Mouse.CursorPos).X;
// Y:=ScreenToClient(Mouse.CursorPos).Y;
cell :=TCustomDBGridEh(DBGridEh1).MouseCoord(x,y);
if (Button = mbLeft) and (Cell.Y>= 0) then
ShowMessage('表头')
else
ShowMessage('表体');
end;
procedure TfrmStockSQL.DBGridEh1DblClick(Sender: TObject);
var
//ARect: TRect;
Cell: TGridCoord ;
Button: TMouseButton;
Shift: TShiftState;
X, Y: Integer ;
begin
MouseUp(Button, Shift, X, Y);
//X:=ScreenToClient(Mouse.CursorPos).X;
// Y:=ScreenToClient(Mouse.CursorPos).Y;
cell :=TCustomDBGridEh(DBGridEh1).MouseCoord(x,y);
if (Button = mbLeft) and (Cell.Y>= 0) then
ShowMessage('表头')
else
ShowMessage('表体');
end;