示例#1
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();
        }
示例#2
0
		/*
		 * InitializeSizeBox
		 */

		private void InitializeSizeBox(SizeBox sizeBox)
		{
			Debug.Assert(sizeBox != null, "sizeBox != null");

			sizeBox.MouseDown += _sizeBox_MouseDown;
			sizeBox.MouseMove += _sizeBox_MouseMove;
			sizeBox.MouseUp += _sizeBox_MouseUp;
		}
示例#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();
		}