对DBGrid做点小小的改动,这是因为DBGrid有点小小的bug,不能支持拖放(Drag&Drop)操作。
unit edbgrid;
interface
uses
DBGrids, Controls, Classes;
type
TEDBGrid = class(TDBGrid)
private
FOnMouseDown: TMouseEvent;
FOnMouseUp: TMouseEvent;
protected
procedure MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y:
Integer); override;
procedure MouseUp(Button: TMouseButton; Shift: TShiftState; X, Y:
Integer); override;
published
Property OnMouseDown : TMouseEvent read FOnMouseDown write
FOnMouseDown ;
Property OnMouseUp : TMouseEvent read FOnMouseUp write FOnMouseUp ;
end;
procedure Register;
implementation
procedure Register;
begin
RegisterComponents('Data Controls',[TEDBGrid]);
end;
procedure TEDBGrid.MouseDown(Button: TMouseButton; Shift: TShiftState;
X, Y: Integer);
begin
inherited MouseDown(Button,Shift,X,Y);
if Assigned(FOnMouseDown) then
FOnMouseDown(Self,Button,Shift,X,Y);
end;
procedure TEDBGrid.MouseUp(Button: TMouseButton; Shift: TShiftState; X,
Y: Integer);
begin
inherited MouseUp(Button,Shift,X,Y);
if Assigned(FOnMouseUp) then
FOnMouseUp(Self,Button,Shift,X,Y);
end;
end.