当调节窗口的大小的时候 垂直滚动条按键盘的上下键可以上下移动,现在我想在窗口自动生成的这个滚动条想用鼠标的滚轮来控制,请问怎么控制

解决方案 »

  1.   

      private
        { Private declarations }
        Procedure OnMouseWheel(Var Msg:TMsg;var Handled:Boolean);
    procedure TForm1.FormCreate(Sender: TObject);
    begin
      Application.OnMessage:=OnMouseWheel;
    end;procedure TForm1.OnMouseWheel(var Msg: TMsg; var Handled: Boolean);
    begin
      if Msg.message = WM_MouseWheel then
      begin
        if Msg.wParam > 0 then
         begin
           if Self.Focused then
             SendMessage(Self.Handle,WM_VSCROLL,SB_PAGEUP,0);
         end
        else
         begin
           if Self.Focused then
             SendMessage(Self.Handle,WM_VSCROLL,SB_PAGEDOWN,0);
         end;
        Handled:= True;
      end;
    end;
      

  2.   

    Application.OnMessage:=OnMouseWheel;
    這句提示Incompatible types: 'Parameter lists differ'的錯誤 為什麼呢