zoukankan      html  css  js  c++  java
  • Scrollbox的滚动条事件scrollbar事件的处理(Lazarus)

    没办法,改源代码:

    找到:Forms单元中scrollbox的父类:
    TScrollingWinControl = class(TCustomControl) 
     
    改:
    { TScrollingWinControl }
      //
      //begin
      TOnAfterScroll=procedure(ScrollKind: TScrollBarKind; OldPosition: Integer) of object;
      //end
      //  
     
     
    TScrollingWinControl = class(TCustomControl)
      private
        FHorzScrollBar: TControlScrollBar;
        FVertScrollBar: TControlScrollBar;
        FAutoScroll: Boolean;
        FIsUpdating: Boolean;
        FonAfterScroll:TOnAfterScroll;//*********add by aliyagoo.com
        procedure SetHorzScrollBar(Value: TControlScrollBar);
        procedure SetVertScrollBar(Value: TControlScrollBar);
        function StoreScrollBars: Boolean;
      protected
        class procedure WSRegisterClass; override;
        procedure AlignControls(AControl: TControl; var ARect: TRect); override;
        procedure CreateWnd; override;
        function GetClientScrollOffset: TPoint; override;
        function GetLogicalClientRect: TRect; override;// logical size of client area
        procedure DoOnResize; override;
        procedure WMHScroll(var Message : TLMHScroll); message LM_HScroll;
        procedure WMVScroll(var Message : TLMVScroll); message LM_VScroll;
        function ComputeScrollbars: Boolean; virtual;
        procedure ScrollbarHandler(ScrollKind: TScrollBarKind;
                                   OldPosition: Integer); virtual;
        procedure SetAutoScroll(Value: Boolean); virtual;
        procedure Loaded; override;
        property AutoScroll: Boolean read FAutoScroll write SetAutoScroll default False;
      public
        constructor Create(TheOwner : TComponent); override;
        destructor Destroy; override;
        procedure UpdateScrollbars;
        function HasVisibleScrollbars: boolean; virtual;
        class function GetControlClassDefaultSize: TPoint; override;
        procedure ScrollBy(DeltaX, DeltaY: Integer);
        property OnAfterScroll:TOnAfterScroll read FonAfterScroll write FonAfterScroll;//***********add by aliyagoo.com
      published
        property HorzScrollBar: TControlScrollBar
                  read FHorzScrollBar write SetHorzScrollBar stored StoreScrollBars;
        property VertScrollBar: TControlScrollBar
                  read FVertScrollBar write SetVertScrollBar stored StoreScrollBars;
      end;               
    然后在Scrollbox里公开属性【公开,不是发布】。
     
    插入事件:ScrollingWinControl.inc 文件
     
    procedure TScrollingWinControl.ScrollbarHandler(ScrollKind: TScrollBarKind;
      OldPosition: Integer);
    begin
      if ScrollKind = sbVertical then
        ScrollBy(0, FVertScrollBar.Position - OldPosition)
      else
        ScrollBy(FHorzScrollBar.Position - OldPosition, 0);
     
        //***********add by aliyagoo
        if Assigned(OnAfterScroll) then FOnAfterScroll(ScrollKind,OldPosition);
        //***********end add
    end;                      

    http://blog.sina.com.cn/s/blog_56294d0a0100w4lx.html

  • 相关阅读:
    软件工程
    python 浮点数四舍六入五成双
    python 比较内嵌字典的值
    python 之多继承顺序及supper()方法执行顺序
    python之装饰器进化
    Centos7 安装Postgres10
    hive常用操作
    MySQL中case when else end 用法
    python写入日志文件时日志内容重复写入
    python向config、ini文件读取写入
  • 原文地址:https://www.cnblogs.com/findumars/p/4759182.html
Copyright © 2011-2022 走看看