怎样实现在DBGrid中双击选择整行,并且可以多选?谢谢!!
时间:2021-07-01 10:21:17
帮助过:28人阅读
TForm1.FormDblClick(Sender: TObject);
begin
ShowMessage(‘双击‘);
end;
procedure TForm1.DBGrid1DblClick(Sender: TObject);
begin
{
DBGrid1.DataSource.DataSet.DisableControls;
DBGrid1.DataSource.DataSet.First;
DBGrid1.SelectedRows.CurrentRowSelected := True;
DBGrid1.DataSource.DataSet.EnableControls;
}
keybd_event(VK_Control, MapVirtualKey(VK_Control, 0),
0,
0);
keybd_event(VK_Control, MapVirtualKey(VK_Control, 0), KEYEVENTF_KEYUP,
0);
//放开Ctrl键
//keybd_event(VK_CONTROL,0,0,0); //模拟按下CTRL键
// ShowMessage(‘双击‘);
//DBGrid1.DataSource.DataSet.GetBookmark()
//DBGrid1.Options dgmultiselect
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
with DBGrid1.DataSource.DataSet
do
begin
DisableControls;
First;
while not Eof
do
begin
DBGrid1.SelectedRows.CurrentRowSelected :=
True;
Next;
end;
EnableControls;
end;
end;
怎样实现在DBGrid中双击选择整行,并且可以多选?谢谢!!
标签:call mouse data cal dataset ctr 取消 bsp disable