一种简单的方法:
把"C:\Program Files\Borland\Delphi5\Source\Vcl\Dbgrids.pas"复制一份到你的工程文件目录下,修改TCustomDBGrid.MouseUp过程,把
if (Button = mbLeft) and (Cell.X >= FIndicatorOffset) and (Cell.Y >= 0) then 改为
if (Button = mbRight) and (Cell.X >= FIndicatorOffset) and (Cell.Y >= 0) then
然后重新编译你的工程.
Enjoy!
把"C:\Program Files\Borland\Delphi5\Source\Vcl\Dbgrids.pas"复制一份到你的工程文件目录下,修改TCustomDBGrid.MouseUp过程,把
if (Button = mbLeft) and (Cell.X >= FIndicatorOffset) and (Cell.Y >= 0) then 改为
if (Button = mbRight) and (Cell.X >= FIndicatorOffset) and (Cell.Y >= 0) then
然后重新编译你的工程.
Enjoy!
DBGrid1.SelectedField.FieldName;