TO:lichdr
下面的怎麼編譯不過呢?
unit MYDBGrid1;
interface
uses
Windows, Messages, SysUtils, Classes, Controls, Grids, DBGrids;
type
TMYDBGrid1 = class(TDBGrid)
procedure WndProc(var Msg: TMessage);override;
private
{ Private declarations }
fMouseWheel:TMouseWheelEvent;
fMouseWheelUp:TMouseWheelUpDownEvent;
fMouseWheelDown: TMouseWheelUpDownEvent;
protected
{ Protected declarations }
public
{ Public declarations }
published
property OnMouseWheel:TMouseWheelEvent read fMouseWheel write fMouseWheel;
property OnMouseWheelUp:TMouseWheelUpDownEvent read fMouseWheelUp write fMouseWheelUp;
property OnMouseWheelDown:TMouseWheelUpDownEvent read fMouseWheelDown write fMouseWheelDown
{ Published declarations }
end;
procedure Register;
implementation
procedure Register;
begin
RegisterComponents('Samples', [TMYDBGrid1]);
end;
procedure WndProc(var Msg: TMessage);
var
MousePoint:TPoint;
Handled:Boolean;
shift:TShiftState;
begin
if(Msg.Msg=WM_MOUSEWHEEL) then
begin
MousePoint.X:=LOWORD(Msg.lParam);
MousePoint.Y:=HIWORD(Msg.lParam);
Handled:=false;
if(Msg.wParam>0) then
fMouseWheelUp(self,shift,MousePoint,Handled)
else
fMouseWheelDown(self,shift,MousePoint,Handled);
fMouseWheel(self,shift,HIWORD(Msg.wParam),MousePoint,Handled);
if Handled then exit;
end;
inherited;
end
end.