Example #1
0
        /*
         * InitializeRightBottomButton
         */

        private void InitializeRightBottomButton(NuGenScrollButton rightBottomButton)
        {
            Debug.Assert(rightBottomButton != null, "rightBottomButton != null");

            rightBottomButton.MouseDown += _rightBottomButton_MouseDown;
            rightBottomButton.MouseUp   += _rightBottomButton_MouseUp;
        }
Example #2
0
        /*
         * InitializeLeftTopButton
         */

        private void InitializeLeftTopButton(NuGenScrollButton leftTopButton)
        {
            Debug.Assert(leftTopButton != null, "leftTopButton != null");

            leftTopButton.MouseDown += _leftTopButton_MouseDown;
            leftTopButton.MouseUp   += _leftTopButton_MouseUp;
        }
Example #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="NuGenScrollBar"/> class.
        /// </summary>
        /// <param name="serviceProvider">
        /// Requires:<para/>
        /// <see cref="INuGenButtonStateService"/><para/>
        /// <see cref="INuGenControlStateService"/><para/>
        /// <see cref="INuGenValueTrackerService"/><para/>
        /// <see cref="INuGenScrollBarRenderer"/><para/>
        /// </param>
        /// <exception cref="ArgumentNullException">
        /// <para><paramref name="serviceProvider"/> is <see langword="null"/>.</para>
        /// </exception>
        public NuGenScrollBar(INuGenServiceProvider serviceProvider)
            : base(serviceProvider)
        {
            _components = new Container();

            _smallChangeDownTimer = new Timer(_components);
            _smallChangeUpTimer   = new Timer(_components);
            _largeChangeDownTimer = new Timer(_components);
            _largeChangeUpTimer   = new Timer(_components);

            _leftTopButton     = new NuGenScrollButton(serviceProvider);
            _rightBottomButton = new NuGenScrollButton(serviceProvider);
            _leftTopTrack      = new ScrollTrack(serviceProvider);
            _rightBottomTrack  = new ScrollTrack(serviceProvider);
            _sizeBox           = new SizeBox(serviceProvider);

            this.InitializeSizeBox(_sizeBox);
            this.InitializeLeftTopButton(_leftTopButton);
            this.InitializeRightBottomButton(_rightBottomButton);
            this.InitializeLeftTopTrack(_leftTopTrack);
            this.InitializeRightBottomTrack(_rightBottomTrack);

            this.InitializeLargeChangeDownTimer(_largeChangeDownTimer);
            this.InitializeLargeChangeUpTimer(_largeChangeUpTimer);
            this.InitializeSmallChangeDownTimer(_smallChangeDownTimer);
            this.InitializeSmallChangeUpTimer(_smallChangeUpTimer);

            this.Controls.AddRange(
                new Control[] {
                _sizeBox
                , _leftTopTrack
                , _rightBottomTrack
                , _leftTopButton
                , _rightBottomButton
            }
                );

            this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
            this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
            this.SetStyle(ControlStyles.SupportsTransparentBackColor, true);
            this.SetStyle(ControlStyles.UserPaint, true);
            this.BackColor = Color.Transparent;

            this.ValueTracker.LargeChange = this.DefaultLargeChange;
            this.ValueTracker.Maximum     = this.DefaultMaximum;
            this.ValueTracker.Minimum     = this.DefaultMinimum;
            this.ValueTracker.SmallChange = this.DefaultSmallChange;
            this.ValueTracker.Value       = this.DefaultValue;

            this.BuildLayout();
        }
		/*
		 * InitializeRightBottomButton
		 */

		private void InitializeRightBottomButton(NuGenScrollButton rightBottomButton)
		{
			Debug.Assert(rightBottomButton != null, "rightBottomButton != null");

			rightBottomButton.MouseDown += _rightBottomButton_MouseDown;
			rightBottomButton.MouseUp += _rightBottomButton_MouseUp;
		}
		/*
		 * InitializeLeftTopButton
		 */

		private void InitializeLeftTopButton(NuGenScrollButton leftTopButton)
		{
			Debug.Assert(leftTopButton != null, "leftTopButton != null");

			leftTopButton.MouseDown += _leftTopButton_MouseDown;
			leftTopButton.MouseUp += _leftTopButton_MouseUp;
		}
		/// <summary>
		/// Initializes a new instance of the <see cref="NuGenScrollBar"/> class.
		/// </summary>
		/// <param name="serviceProvider">
		/// Requires:<para/>
		/// <see cref="INuGenButtonStateService"/><para/>
		/// <see cref="INuGenControlStateService"/><para/>
		/// <see cref="INuGenValueTrackerService"/><para/>
		/// <see cref="INuGenScrollBarRenderer"/><para/>
		/// </param>
		/// <exception cref="ArgumentNullException">
		/// <para><paramref name="serviceProvider"/> is <see langword="null"/>.</para>
		/// </exception>
		public NuGenScrollBar(INuGenServiceProvider serviceProvider)
			: base(serviceProvider)
		{
			_components = new Container();

			_smallChangeDownTimer = new Timer(_components);
			_smallChangeUpTimer = new Timer(_components);
			_largeChangeDownTimer = new Timer(_components);
			_largeChangeUpTimer = new Timer(_components);

			_leftTopButton = new NuGenScrollButton(serviceProvider);
			_rightBottomButton = new NuGenScrollButton(serviceProvider);
			_leftTopTrack = new ScrollTrack(serviceProvider);
			_rightBottomTrack = new ScrollTrack(serviceProvider);
			_sizeBox = new SizeBox(serviceProvider);

			this.InitializeSizeBox(_sizeBox);
			this.InitializeLeftTopButton(_leftTopButton);
			this.InitializeRightBottomButton(_rightBottomButton);
			this.InitializeLeftTopTrack(_leftTopTrack);
			this.InitializeRightBottomTrack(_rightBottomTrack);

			this.InitializeLargeChangeDownTimer(_largeChangeDownTimer);
			this.InitializeLargeChangeUpTimer(_largeChangeUpTimer);
			this.InitializeSmallChangeDownTimer(_smallChangeDownTimer);
			this.InitializeSmallChangeUpTimer(_smallChangeUpTimer);

			this.Controls.AddRange(
				new Control[] {
					_sizeBox
					, _leftTopTrack
					, _rightBottomTrack
					, _leftTopButton
					, _rightBottomButton
				}
			);

			this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
			this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
			this.SetStyle(ControlStyles.SupportsTransparentBackColor, true);
			this.SetStyle(ControlStyles.UserPaint, true);
			this.BackColor = Color.Transparent;

			this.ValueTracker.LargeChange = this.DefaultLargeChange;
			this.ValueTracker.Maximum = this.DefaultMaximum;
			this.ValueTracker.Minimum = this.DefaultMinimum;
			this.ValueTracker.SmallChange = this.DefaultSmallChange;
			this.ValueTracker.Value = this.DefaultValue;

			this.BuildLayout();
		}