我想自定义TDBGrid:
1)添加onSelect/onUnselect事件-例如,good用于显示选定项目的计数。
2)在鼠标左键单击时删除选择项。我继承了TDBGrid并重写了MouseDown,但无法移动列或调整列的大小:(
那么,该怎么做呢?
D2009
发布于 2009-01-29 14:02:26
您需要检查选定属性中的更改。
发布于 2009-01-29 15:05:41
这就完成了我的工作:
implementation
{$R *.dfm}
type
THackDBGrid = class(TDBGrid);
//for info on why we must do this, see:
//http://delphi.about.com/od/oopindelphi/l/aa082603a.htm
var
LastValidRow: integer;
procedure TForm1.DataSource1DataChange(Sender: TObject; Field: TField);
begin
//assign this to the TDBGrid.DataSource.DataSet.OnDataChange Event
if 0 <> HiWord(GetKeyState(VK_LBUTTON)) then begin
THackDBGrid(DBGrid1).Row := LastValidRow;
end
else begin
LastValidRow := THackDBGrid(DBGrid1).Row;
inherited;
end;
end;发布于 2008-12-17 14:57:30
我认为您可能需要确保允许继承的Mousedown运行,以便执行标准的移动和调整大小行为。
https://stackoverflow.com/questions/374561
复制相似问题