怎么为同时选中的几个dbgrid的onkeyDown写入事件代码?
我试过属性可以同时赋值,但是事件似乎要分开写,很麻烦
[解决办法]
举个例子:
假设DBGrid1,DBGrid2,DBGrid3的OnKeyDown事件都指向DBGrid1KeyDown,那么:
void __fastcall TForm1::DBGrid1KeyDown(TObject *Sender, WORD &Key, TShiftState Shift){ if (Sender == DBGrid1) Caption = "DBGrid1"; else if (Sender == DBGrid2) Caption = "DBGrid2"; else if (Sender == DBGrid3) Caption = "DBGrid3";}