procedure TForm1.DBGrid1CellClick(Column: TColumn); begin if column.FieldName = 'spid' then showmessage(''); end;
to andyzhou1101: 是双击产生事件,不是单击。
分分少了点,不过代码不算太难 procedure TForm1.DBGrid1DblClick(Sender: TObject); var mGridCoord: TGridCoord; begin mGridCoord := dbgrid1.MouseCoord(MouseX,MouseY); ShowMessage(Format('%d %d',[mGridCoord.X,mGridCoord.Y])); end;procedure TForm1.DBGrid1MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer); begin MouseX := X; MouseY := Y; end;
procedure TForm1.DBGrid1DblClick(Sender: TObject); begin if DBGrid1.SelectedIndex >= 0 then Exit; Caption := DBGrid1.Columns[DBGrid1.SelectedIndex].FieldName; end;
procedure TForm1.DBGrid1DblClick(Sender: TObject); begin if DBGrid1.SelectedIndex >= 0 then Exit; Caption := DBGrid1.Columns[DBGrid1.SelectedIndex].FieldName; end;
begin
if column.FieldName = 'spid' then showmessage('');
end;
是双击产生事件,不是单击。
procedure TForm1.DBGrid1DblClick(Sender: TObject);
var
mGridCoord: TGridCoord;
begin
mGridCoord := dbgrid1.MouseCoord(MouseX,MouseY);
ShowMessage(Format('%d %d',[mGridCoord.X,mGridCoord.Y]));
end;procedure TForm1.DBGrid1MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
begin
MouseX := X;
MouseY := Y;
end;
begin
if DBGrid1.SelectedIndex >= 0 then Exit;
Caption := DBGrid1.Columns[DBGrid1.SelectedIndex].FieldName;
end;
begin
if DBGrid1.SelectedIndex >= 0 then Exit;
Caption := DBGrid1.Columns[DBGrid1.SelectedIndex].FieldName;
end;