当我点击CheckListBox的滚动条时,想做一定的处理,该写哪个事件啊,或者如何捕捉到也行

解决方案 »

  1.   

    type
      TForm1 = class(TForm)
        CheckListBox1: TCheckListBox;
        Button1: TButton;
        procedure FormCreate(Sender: TObject);
      private
        OldWndProc:TWndMethod;
        procedure NewWndProc(var Msg:TMessage);Message WM_VSCROLL;
        { Private declarations }
      public
        { Public declarations }
      end;var
      Form1: TForm1;implementation{$R *.dfm}procedure TForm1.NewWndProc(var Msg: TMessage);
    begin
      if Msg.Msg = WM_VSCROLL then ShowMessage('接收到滚动条消息');
      if Assigned(OldWndProc) then
        OldWndProc(Msg);
    end;procedure TForm1.FormCreate(Sender: TObject);
    begin
      OldWndProc:=CheckListBox1.WindowProc;
      CheckListBox1.WindowProc:=NewWndProc;
    end;
      

  2.   

    不好意思,
    procedure NewWndProc(var Msg:TMessage);Message WM_VSCROLL;
    这一句的Message WM_VSCROLL应该去掉