public CustomScrollBarAdapter(Orientation orientation, CustomScrollBarRenderer renderer) { switch(orientation) { case Orientation.Vertical: _scrollBar = new CustomVScrollbar() { Renderer = renderer }; break; case Orientation.Horizontal: _scrollBar = new CustomHScrollbar() { Renderer = renderer }; break; default: throw new ArgumentException("orientation"); } _scrollBar.Scroll += OnScrollBarScroll; _scrollBar.ValueChanged += OnScrollBarValueChanged; }
public CustomScrollBar() { SetStyle( ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer | ControlStyles.Opaque | ControlStyles.ResizeRedraw | ControlStyles.Selectable | ControlStyles.UserPaint, true); SetStyle( ControlStyles.ContainerControl | ControlStyles.UseTextForAccessibility | ControlStyles.SupportsTransparentBackColor, false); TabStop = false; _renderer = CustomScrollBarRenderer.Default; _maximum = 100; _smallChange = 1; _largeChange = 10; _timer = new Timer(); _timer.Tick += OnTimerTick; }
public CustomScrollBarAdapter(Orientation orientation, CustomScrollBarRenderer renderer) { switch (orientation) { case Orientation.Vertical: _scrollBar = new CustomVScrollbar() { Renderer = renderer }; break; case Orientation.Horizontal: _scrollBar = new CustomHScrollbar() { Renderer = renderer }; break; default: throw new ArgumentException("orientation"); } _scrollBar.Scroll += OnScrollBarScroll; _scrollBar.ValueChanged += OnScrollBarValueChanged; }