/// <summary>
		/// </summary>
		/// <param name="paintParams"></param>
		/// <exception cref="ArgumentNullException">
		/// <para><paramref name="paintParams"/> is <see langword="null"/>.</para>
		/// </exception>
		public void DrawCWRotateButton(NuGenPaintParams paintParams)
		{
			if (paintParams == null)
			{
				throw new ArgumentNullException("paintParams");
			}

			NuGenImagePaintParams imagePaintParams = new NuGenImagePaintParams(paintParams);

			switch (imagePaintParams.State)
			{
				case NuGenControlState.Hot:
				case NuGenControlState.Pressed:
				{
					imagePaintParams.Image = res.RotateCW_Hot;
					break;
				}
				default:
				{
					imagePaintParams.Image = res.RotateCW_Normal;
					break;
				}
			}

			this.DrawImage(imagePaintParams);
		}
Пример #2
0
        /*
         * OnPaint
         */

        /// <summary>
        /// Raises the <see cref="E:System.Windows.Forms.Control.Paint"></see> event.
        /// </summary>
        /// <param name="e">A <see cref="T:System.Windows.Forms.PaintEventArgs"></see> that contains the event data.</param>
        protected override void OnPaint(PaintEventArgs e)
        {
            Debug.Assert(this.ButtonStateTracker != null, "this.ButtonStateTracker != null");
            Debug.Assert(this.Renderer != null, "this.Renderer != null");

            Graphics          g             = e.Graphics;
            NuGenControlState currentState  = this.ButtonStateTracker.GetControlState();
            Rectangle         bounds        = this.ClientRectangle;
            Rectangle         contentBounds = this.LayoutManager.GetContentRectangle(bounds);

            NuGenPaintParams paintParams = new NuGenPaintParams(g);

            paintParams.Bounds = bounds;
            paintParams.State  = currentState;

            this.Renderer.DrawBackground(paintParams);
            this.Renderer.DrawShadow(paintParams);
            this.Renderer.DrawBorder(paintParams);

            Image            image       = this.Image;
            Rectangle        imageBounds = Rectangle.Empty;
            ContentAlignment imageAlign  = this.ImageAlign;

            if (image != null)
            {
                NuGenImagePaintParams imagePaintParams = new NuGenImagePaintParams(g);
                imagePaintParams.Bounds = imageBounds = this.LayoutManager.GetImageBounds(
                    new NuGenBoundsParams(
                        contentBounds
                        , imageAlign
                        , new Rectangle(Point.Empty, image.Size)
                        , this.RightToLeft
                        )
                    );
                imagePaintParams.Image = image;
                imagePaintParams.State = currentState;

                this.Renderer.DrawImage(imagePaintParams);
            }

            if (imageBounds != Rectangle.Empty)
            {
                imageBounds.Inflate(3, 3);
            }

            NuGenTextPaintParams textPaintParams = new NuGenTextPaintParams(g);

            textPaintParams.Bounds = this.LayoutManager.GetTextBounds(
                new NuGenBoundsParams(contentBounds, imageAlign, imageBounds, this.RightToLeft)
                );
            textPaintParams.Font      = this.Font;
            textPaintParams.ForeColor = this.ForeColor;
            textPaintParams.Text      = this.Text;
            textPaintParams.TextAlign = NuGenControlPaint.RTLContentAlignment(this.TextAlign, this.RightToLeft);
            textPaintParams.State     = currentState;

            this.Renderer.DrawText(textPaintParams);
        }
Пример #3
0
		/// <summary>
		/// </summary>
		/// <param name="paintParams"></param>
		/// <exception cref="ArgumentNullException">
		/// <para><paramref name="paintParams"/> is <see langword="null"/>.</para>
		/// </exception>
		public void DrawImage(NuGenImagePaintParams paintParams)
		{
			if (paintParams == null)
			{
				throw new ArgumentNullException("paintParams");
			}

			this.DrawImage(
				paintParams.Graphics,
				paintParams.Bounds,
				paintParams.State,
				paintParams.Image
			);
		}
Пример #4
0
        /// <summary>
        /// </summary>
        /// <param name="paintParams"></param>
        /// <exception cref="ArgumentNullException">
        /// <para><paramref name="paintParams"/> is <see langword="null"/>.</para>
        /// </exception>
        public void DrawImage(NuGenImagePaintParams paintParams)
        {
            if (paintParams == null)
            {
                throw new ArgumentNullException("paintParams");
            }

            this.DrawImage(
                paintParams.Graphics,
                paintParams.Bounds,
                paintParams.State,
                paintParams.Image
                );
        }
Пример #5
0
            /*
             * DrawButton
             */

            private void DrawButton(Graphics g, NuGenNavigationButton button)
            {
                Debug.Assert(g != null, "g != null");
                Debug.Assert(button != null, "button != null");

                NuGenControlState buttonState = this.StateTracker.GetControlState();

                if (button == _hoveringButton)
                {
                    buttonState = button == _selectedButton ? NuGenControlState.Pressed : NuGenControlState.Hot;
                }
                else
                {
                    if (button == _selectedButton)
                    {
                        buttonState = NuGenControlState.Pressed;
                    }
                }

                NuGenPaintParams paintParams = new NuGenPaintParams(g);

                paintParams.Bounds = button.Bounds;
                paintParams.State  = buttonState;

                this.Renderer.DrawBackground(paintParams);

                if (button.IsLarge)
                {
                    NuGenItemPaintParams itemPaintParams = new NuGenItemPaintParams(paintParams);

                    itemPaintParams.ContentAlign = ContentAlignment.MiddleLeft;
                    itemPaintParams.Font         = this.Font;
                    itemPaintParams.ForeColor    = this.ForeColor;
                    itemPaintParams.Image        = button.Image;
                    itemPaintParams.Text         = button.Text;

                    this.Renderer.DrawLargeButtonBody(itemPaintParams);
                    this.Renderer.DrawButtonBorder(paintParams);
                }
                else
                {
                    NuGenImagePaintParams imagePaintParams = new NuGenImagePaintParams(paintParams);
                    imagePaintParams.Image = button.Image;

                    this.Renderer.DrawSmallButtonBody(imagePaintParams);
                }
            }
Пример #6
0
        /*
         * OnPaint
         */

        /// <summary>
        /// Raises the <see cref="E:System.Windows.Forms.Control.Paint"></see> event.
        /// </summary>
        /// <param name="e">A <see cref="T:System.Windows.Forms.PaintEventArgs"></see> that contains the event data.</param>
        protected override void OnPaint(PaintEventArgs e)
        {
            Debug.Assert(this.ButtonStateTracker != null, "this.ButtonStateTracker != null");
            Debug.Assert(this.Renderer != null, "this.Renderer != null");

            Graphics          g             = e.Graphics;
            NuGenControlState currentState  = this.ButtonStateTracker.GetControlState();
            Rectangle         bounds        = this.ClientRectangle;
            Rectangle         contentBounds = this.LayoutManager.GetContentRectangle(this.ClientRectangle);

            NuGenPaintParams paintParams = new NuGenPaintParams(this, g, bounds, currentState);

            this.Renderer.DrawBackground(paintParams);
            this.Renderer.DrawShadow(paintParams);
            this.Renderer.DrawBorder(paintParams);

            Image            image       = this.Image;
            Rectangle        imageBounds = Rectangle.Empty;
            ContentAlignment imageAlign  = this.ImageAlign;

            if (image != null)
            {
                NuGenImagePaintParams imagePaintParams = new NuGenImagePaintParams(
                    this,
                    g,
                    imageBounds = this.LayoutManager.GetImageBounds(new NuGenImageBoundsParams(contentBounds, image, imageAlign)),
                    currentState,
                    image
                    );

                this.Renderer.DrawImage(imagePaintParams);
            }

            NuGenTextPaintParams textPaintParams = new NuGenTextPaintParams(
                this,
                g,
                this.LayoutManager.GetTextBounds(new NuGenTextBoundsParams(contentBounds, imageBounds, imageAlign)),
                currentState,
                this.Text
                );

            textPaintParams.Font      = this.Font;
            textPaintParams.ForeColor = this.ForeColor;
            textPaintParams.TextAlign = this.TextAlign;

            this.Renderer.DrawText(textPaintParams);
        }
Пример #7
0
        /*
         * OnPaint
         */

        /// <summary>
        /// Raises the paint event.
        /// </summary>
        /// <param name="e">The <see cref="System.Windows.Forms.PaintEventArgs"/> instance containing the event data.</param>
        protected override void OnPaint(PaintEventArgs e)
        {
            Graphics          g            = e.Graphics;
            Rectangle         bounds       = this.ClientRectangle;
            NuGenControlState currentState = this.ButtonStateTracker.GetControlState();
            Image             image        = this.Image;
            ContentAlignment  imageAlign   = this.ImageAlign;
            Rectangle         imageBounds  = Rectangle.Empty;

            if (image != null)
            {
                NuGenImagePaintParams imagePaintParams = new NuGenImagePaintParams(g);
                imagePaintParams.Bounds = imageBounds = this.LayoutManager.GetImageBounds(
                    new NuGenBoundsParams(
                        bounds
                        , imageAlign
                        , new Rectangle(Point.Empty, image.Size)
                        , this.RightToLeft
                        )
                    );
                imagePaintParams.Image = image;
                imagePaintParams.State = currentState;

                this.Renderer.DrawImage(imagePaintParams);
            }

            NuGenTextPaintParams textPaintParams = new NuGenTextPaintParams(g);

            textPaintParams.Bounds = this.LayoutManager.GetTextBounds(
                new NuGenBoundsParams(
                    bounds
                    , imageAlign
                    , imageBounds
                    , this.RightToLeft
                    )
                );
            textPaintParams.Font      = this.Font;
            textPaintParams.ForeColor = this.ForeColor;
            textPaintParams.Text      = this.Text;
            textPaintParams.TextAlign = NuGenControlPaint.RTLContentAlignment(this.TextAlign, this.RightToLeft);
            textPaintParams.State     = currentState;

            this.Renderer.DrawText(textPaintParams);
        }
		/// <summary>
		/// </summary>
		/// <param name="paintParams"></param>
		/// <exception cref="ArgumentNullException">
		/// <para><paramref name="paintParams"/> is <see langword="null"/>.</para>
		/// </exception>
		public void DrawSmallButtonBody(NuGenImagePaintParams paintParams)
		{
			if (paintParams == null)
			{
				throw new ArgumentNullException("paintParams");
			}

			Graphics g = paintParams.Graphics;
			Rectangle bounds = paintParams.Bounds;
			NuGenControlState state = paintParams.State;

			Image image = paintParams.Image;

			if (image != null)
			{
				this.DrawImage(g, NuGenSmoothNavigationBarRenderer.GetSmallImageBounds(bounds), state, image);
			}
		}
Пример #9
0
		/*
		 * OnPaint
		 */

		/// <summary>
		/// Raises the <see cref="E:System.Windows.Forms.Control.Paint"></see> event.
		/// </summary>
		/// <param name="e">A <see cref="T:System.Windows.Forms.PaintEventArgs"></see> that contains the event data.</param>
		protected override void OnPaint(PaintEventArgs e)
		{
			Debug.Assert(this.ButtonStateTracker != null, "this.ButtonStateTracker != null");
			Debug.Assert(this.Renderer != null, "this.Renderer != null");

			Graphics g = e.Graphics;
			NuGenControlState currentState = this.ButtonStateTracker.GetControlState();
			Rectangle bounds = this.ClientRectangle;
			Rectangle contentBounds = this.LayoutManager.GetContentRectangle(this.ClientRectangle);

			NuGenPaintParams paintParams = new NuGenPaintParams(this, g, bounds, currentState);

			this.Renderer.DrawBackground(paintParams);
			this.Renderer.DrawShadow(paintParams);
			this.Renderer.DrawBorder(paintParams);

			Image image = this.Image;
			Rectangle imageBounds = Rectangle.Empty;
			ContentAlignment imageAlign = this.ImageAlign;

			if (image != null)
			{
				NuGenImagePaintParams imagePaintParams = new NuGenImagePaintParams(
					this,
					g,
					imageBounds = this.LayoutManager.GetImageBounds(new NuGenImageBoundsParams(contentBounds, image, imageAlign)),
					currentState,
					image
				);

				this.Renderer.DrawImage(imagePaintParams);
			}

			NuGenTextPaintParams textPaintParams = new NuGenTextPaintParams(
				this,
				g,
				this.LayoutManager.GetTextBounds(new NuGenTextBoundsParams(contentBounds, imageBounds, imageAlign)),
				currentState,
				this.Text
			);
			textPaintParams.Font = this.Font;
			textPaintParams.ForeColor = this.ForeColor;
			textPaintParams.TextAlign = this.TextAlign;

			this.Renderer.DrawText(textPaintParams);
		}
Пример #10
0
        /*
         * OnPaint
         */

        /// <summary>
        /// Raises the <see cref="E:System.Windows.Forms.Control.Paint"/> event.
        /// </summary>
        /// <param name="e">A <see cref="T:System.Windows.Forms.PaintEventArgs"/> that contains the event data.</param>
        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);
            Graphics g = e.Graphics;

            if (this.Image != null)
            {
                Rectangle imageBounds = this.ClientRectangle;

                switch (this.DisplayMode)
                {
                case NuGenDisplayMode.ActualSize:
                {
                    if (this.AutoScrollPosition.X == 0 &&
                        this.AutoScrollPosition.Y == 0 &&
                        this.AutoScrollMinSize.Width <= this.ClientRectangle.Width &&
                        this.AutoScrollMinSize.Height <= this.ClientRectangle.Height
                        )
                    {
                        imageBounds = NuGenControlPaint.ImageBoundsFromContentAlignment(
                            this.Image.Size
                            , this.ClientRectangle
                            , this.ImageAlign
                            );
                    }
                    else
                    {
                        imageBounds = new Rectangle(
                            this.AutoScrollPosition.X
                            , this.AutoScrollPosition.Y
                            , this.Image.Width
                            , this.Image.Height
                            );
                    }

                    break;
                }

                case NuGenDisplayMode.Zoom:
                {
                    imageBounds = new Rectangle(
                        (int)(this.AutoScrollPosition.X / _zoomFactor)
                        , (int)(this.AutoScrollPosition.Y / _zoomFactor)
                        , (int)(this.Image.Width * _zoomFactor)
                        , (int)(this.Image.Height * _zoomFactor)
                        );
                    float zoomFactor = (float)_zoomFactor;
                    g.ScaleTransform(zoomFactor, zoomFactor);
                    break;
                }

                case NuGenDisplayMode.ScaleToFit:
                {
                    imageBounds = NuGenControlPaint.ScaleToFit(this.ClientRectangle, this.Image.Size);
                    break;
                }
                }

                NuGenImagePaintParams imagePaintParams = new NuGenImagePaintParams(g);
                imagePaintParams.Bounds = imageBounds;
                imagePaintParams.Image  = this.Image;
                imagePaintParams.State  = this.StateTracker.GetControlState();

                this.Renderer.DrawImage(imagePaintParams);
            }
        }
Пример #11
0
		/// <summary>
		/// Raises the <see cref="E:System.Windows.Forms.Control.Paint"></see> event.
		/// </summary>
		/// <param name="e">A <see cref="T:System.Windows.Forms.PaintEventArgs"></see> that contains the event data.</param>
		protected override void OnPaint(PaintEventArgs e)
		{
			NuGenPaintParams paintParams = new NuGenPaintParams(e.Graphics);
			paintParams.Bounds = this.ClientRectangle;
			paintParams.State = this.ButtonStateTracker.GetControlState();

			switch (paintParams.State)
			{
				case NuGenControlState.Pressed:
				case NuGenControlState.Hot:
				{
					_cwRotateButton.Visible = _ccwRotateButton.Visible = true;
					break;
				}
				default:
				{
					_cwRotateButton.Visible = _ccwRotateButton.Visible = false;
					break;
				}
			}

			this.Renderer.DrawBackground(paintParams);
			this.Renderer.DrawBorder(paintParams);

			NuGenTextPaintParams textPaintParams = new NuGenTextPaintParams(paintParams);

			using (Font font = this.Renderer.GetFont(textPaintParams.Bounds))
			{
				textPaintParams.Bounds = this.LayoutManager.GetTextBounds(textPaintParams.Bounds, font.Size);
				textPaintParams.Font = font;
				textPaintParams.ForeColor = this.Renderer.GetForeColor(textPaintParams.State);
				textPaintParams.Text = this.Text;
				textPaintParams.TextAlign = this.TextAlign;

				this.Renderer.DrawText(textPaintParams);
			}

			Image image = this.Image;

			if (image != null)
			{
				NuGenImagePaintParams imagePaintParams = new NuGenImagePaintParams(paintParams);
				imagePaintParams.Bounds = this.LayoutManager.GetImageBounds(imagePaintParams.Bounds, image.Size);
				imagePaintParams.Image = image;

				this.Renderer.DrawImage(imagePaintParams);
				this.Renderer.DrawBorder(imagePaintParams);
			}

			base.OnPaint(e);
		}
Пример #12
0
		/// <summary>
		/// Raises the <see cref="E:System.Windows.Forms.Control.Paint"></see> event.
		/// </summary>
		/// <param name="e">A <see cref="T:System.Windows.Forms.PaintEventArgs"></see> that contains the event data.</param>
		protected override void OnPaint(PaintEventArgs e)
		{
			Graphics g = e.Graphics;
			Rectangle bounds = this.ClientRectangle;

			if (this.Orientation == NuGenOrientationStyle.Horizontal)
			{
				bounds.X++;
				bounds.Width -= 2;
			}
			else
			{
				bounds.Y++;
				bounds.Height -= 2;
			}

			Rectangle contentBounds = this.LayoutManager.GetContentRectangle(bounds);
			NuGenControlState currentState = this.ButtonStateTracker.GetControlState();

			NuGenPaintParams paintParams = new NuGenPaintParams(e.Graphics);
			paintParams.Bounds = bounds;
			paintParams.State = currentState;

			if (currentState != NuGenControlState.Normal)
			{
				this.Renderer.DrawBackground(paintParams);
				
				NuGenPaintParams borderPaintParams = new NuGenPaintParams(paintParams);
				borderPaintParams.Bounds = NuGenControlPaint.BorderRectangle(borderPaintParams.Bounds);
				this.Renderer.DrawBorder(borderPaintParams);
			}

			Image image = this.Image;
			Rectangle imageBounds = Rectangle.Empty;
			ContentAlignment imageAlign = this.ImageAlign;

			if (image != null)
			{
				NuGenImagePaintParams imagePaintParams = new NuGenImagePaintParams(g);
				imagePaintParams.Bounds = imageBounds = this.LayoutManager.GetImageBounds(
					new NuGenBoundsParams(contentBounds
						, imageAlign
						, new Rectangle(Point.Empty, image.Size)
						, this.RightToLeft
					)
				);
				imagePaintParams.Image = image;
				imagePaintParams.State = currentState;

				this.Renderer.DrawImage(imagePaintParams);
			}

			if (imageBounds != Rectangle.Empty)
			{
				imageBounds.Inflate(3, 3);
			}

			NuGenTextPaintParams textPaintParams = new NuGenTextPaintParams(g);

			textPaintParams.Bounds = this.LayoutManager.GetTextBounds(
				new NuGenBoundsParams(contentBounds, imageAlign, imageBounds, this.RightToLeft)
			);
			textPaintParams.Font = this.Font;
			textPaintParams.ForeColor = this.ForeColor;
			textPaintParams.Text = this.Text;
			textPaintParams.TextAlign = NuGenControlPaint.RTLContentAlignment(this.TextAlign, this.RightToLeft);
			textPaintParams.State = currentState;

			this.Renderer.DrawText(textPaintParams);
		}
            /*
             * OnPaint
             */

            protected override void OnPaint(PaintEventArgs e)
            {
                Graphics g = e.Graphics;

                Rectangle bounds       = this.ClientRectangle;
                Size      shadowSize   = this.LayoutManager.GetShadowSize();
                Rectangle shadowBounds = new Rectangle(
                    bounds.Left + shadowSize.Width,
                    bounds.Top + shadowSize.Height,
                    bounds.Width - shadowSize.Width,
                    bounds.Height - shadowSize.Height
                    );
                Rectangle bodyBounds = new Rectangle(
                    bounds.Left,
                    bounds.Top,
                    bounds.Width - shadowSize.Width,
                    bounds.Height - shadowSize.Height
                    );

                NuGenPaintParams paintParams = new NuGenPaintParams(g);

                paintParams.State = _state;

                paintParams.Bounds = shadowBounds;
                this.Renderer.DrawShadow(paintParams);

                paintParams.Bounds = bodyBounds;
                this.Renderer.DrawBackground(paintParams);
                this.Renderer.DrawBorder(paintParams);

                if (_tooltipInfo != null)
                {
                    NuGenTextPaintParams textPaintParams = new NuGenTextPaintParams(paintParams);
                    textPaintParams.TextAlign = ContentAlignment.MiddleLeft;
                    textPaintParams.ForeColor = this.ForeColor;

                    NuGenImagePaintParams imagePaintParams = new NuGenImagePaintParams(paintParams);

                    if (_tooltipInfo.IsHeaderVisible)
                    {
                        textPaintParams.Bounds = _layoutDescriptor.HeaderBounds;
                        textPaintParams.Font   = _headerFont;
                        textPaintParams.Text   = _tooltipInfo.Header;

                        this.Renderer.DrawHeaderText(textPaintParams);
                    }

                    if (_tooltipInfo.IsTextVisible)
                    {
                        textPaintParams.Bounds = _layoutDescriptor.TextBounds;
                        textPaintParams.Font   = _textFont;
                        textPaintParams.Text   = _tooltipInfo.Text;

                        this.Renderer.DrawText(textPaintParams);
                    }

                    if (_tooltipInfo.IsImageVisible)
                    {
                        imagePaintParams.Bounds = _layoutDescriptor.ImageBounds;
                        imagePaintParams.Image  = _tooltipInfo.Image;

                        this.Renderer.DrawImage(imagePaintParams);
                    }

                    if (_tooltipInfo.IsRemarksHeaderVisible)
                    {
                        textPaintParams.Bounds = _layoutDescriptor.RemarksHeaderBounds;
                        textPaintParams.Font   = _headerFont;
                        textPaintParams.Text   = _tooltipInfo.RemarksHeader;

                        this.Renderer.DrawHeaderText(textPaintParams);

                        if (_tooltipInfo.IsRemarksVisible)
                        {
                            textPaintParams.Bounds = _layoutDescriptor.RemarksBounds;
                            textPaintParams.Font   = _textFont;
                            textPaintParams.Text   = _tooltipInfo.Remarks;

                            this.Renderer.DrawText(textPaintParams);
                        }

                        if (_tooltipInfo.IsRemarksImageVisible)
                        {
                            imagePaintParams.Bounds = _layoutDescriptor.RemarksImageBounds;
                            imagePaintParams.Image  = _tooltipInfo.RemarksImage;

                            this.Renderer.DrawImage(imagePaintParams);
                        }

                        paintParams.Bounds = _layoutDescriptor.BevelBounds;
                        this.Renderer.DrawBevel(paintParams);
                    }
                }
            }
			/*
			 * DrawButton
			 */

			private void DrawButton(Graphics g, NuGenNavigationButton button)
			{
				Debug.Assert(g != null, "g != null");
				Debug.Assert(button != null, "button != null");

				NuGenControlState buttonState = this.StateTracker.GetControlState();

				if (button == _hoveringButton)
				{
					buttonState = button == _selectedButton ? NuGenControlState.Pressed : NuGenControlState.Hot;
				}
				else
				{
					if (button == _selectedButton)
					{
						buttonState = NuGenControlState.Pressed;
					}
				}

				NuGenPaintParams paintParams = new NuGenPaintParams(g);
				paintParams.Bounds = button.Bounds;
				paintParams.State = buttonState;

				this.Renderer.DrawBackground(paintParams);

				if (button.IsLarge)
				{
					NuGenItemPaintParams itemPaintParams = new NuGenItemPaintParams(paintParams);

					itemPaintParams.ContentAlign = ContentAlignment.MiddleLeft;
					itemPaintParams.Font = this.Font;
					itemPaintParams.ForeColor = this.ForeColor;
					itemPaintParams.Image = button.Image;
					itemPaintParams.Text = button.Text;

					this.Renderer.DrawLargeButtonBody(itemPaintParams);
					this.Renderer.DrawButtonBorder(paintParams);
				}
				else
				{
					NuGenImagePaintParams imagePaintParams = new NuGenImagePaintParams(paintParams);
					imagePaintParams.Image = button.Image;

					this.Renderer.DrawSmallButtonBody(imagePaintParams);
				}
			}
			/*
			 * OnPaint
			 */

			protected override void OnPaint(PaintEventArgs e)
			{
				Graphics g = e.Graphics;

				Rectangle bounds = this.ClientRectangle;
				Size shadowSize = this.LayoutManager.GetShadowSize();
				Rectangle shadowBounds = new Rectangle(
					bounds.Left + shadowSize.Width,
					bounds.Top + shadowSize.Height,
					bounds.Width - shadowSize.Width,
					bounds.Height - shadowSize.Height
				);
				Rectangle bodyBounds = new Rectangle(
					bounds.Left,
					bounds.Top,
					bounds.Width - shadowSize.Width,
					bounds.Height - shadowSize.Height
				);

				NuGenPaintParams paintParams = new NuGenPaintParams(g);
				paintParams.State = _state;

				paintParams.Bounds = shadowBounds;
				this.Renderer.DrawShadow(paintParams);

				paintParams.Bounds = bodyBounds;
				this.Renderer.DrawBackground(paintParams);
				this.Renderer.DrawBorder(paintParams);

				if (_tooltipInfo != null)
				{
					NuGenTextPaintParams textPaintParams = new NuGenTextPaintParams(paintParams);
					textPaintParams.TextAlign = ContentAlignment.MiddleLeft;
					textPaintParams.ForeColor = this.ForeColor;

					NuGenImagePaintParams imagePaintParams = new NuGenImagePaintParams(paintParams);

					if (_tooltipInfo.IsHeaderVisible)
					{
						textPaintParams.Bounds = _layoutDescriptor.HeaderBounds;
						textPaintParams.Font = _headerFont;
						textPaintParams.Text = _tooltipInfo.Header;

						this.Renderer.DrawHeaderText(textPaintParams);
					}

					if (_tooltipInfo.IsTextVisible)
					{
						textPaintParams.Bounds = _layoutDescriptor.TextBounds;
						textPaintParams.Font = _textFont;
						textPaintParams.Text = _tooltipInfo.Text;

						this.Renderer.DrawText(textPaintParams);
					}

					if (_tooltipInfo.IsImageVisible)
					{
						imagePaintParams.Bounds = _layoutDescriptor.ImageBounds;
						imagePaintParams.Image = _tooltipInfo.Image;

						this.Renderer.DrawImage(imagePaintParams);
					}

					if (_tooltipInfo.IsRemarksHeaderVisible)
					{
						textPaintParams.Bounds = _layoutDescriptor.RemarksHeaderBounds;
						textPaintParams.Font = _headerFont;
						textPaintParams.Text = _tooltipInfo.RemarksHeader;

						this.Renderer.DrawHeaderText(textPaintParams);

						if (_tooltipInfo.IsRemarksVisible)
						{
							textPaintParams.Bounds = _layoutDescriptor.RemarksBounds;
							textPaintParams.Font = _textFont;
							textPaintParams.Text = _tooltipInfo.Remarks;

							this.Renderer.DrawText(textPaintParams);
						}

						if (_tooltipInfo.IsRemarksImageVisible)
						{
							imagePaintParams.Bounds = _layoutDescriptor.RemarksImageBounds;
							imagePaintParams.Image = _tooltipInfo.RemarksImage;

							this.Renderer.DrawImage(imagePaintParams);
						}

						paintParams.Bounds = _layoutDescriptor.BevelBounds;
						this.Renderer.DrawBevel(paintParams);
					}
				}
			}
Пример #16
0
		/*
		 * OnPaint
		 */

		/// <summary>
		/// Raises the <see cref="E:System.Windows.Forms.Control.Paint"/> event.
		/// </summary>
		/// <param name="e">A <see cref="T:System.Windows.Forms.PaintEventArgs"/> that contains the event data.</param>
		protected override void OnPaint(PaintEventArgs e)
		{
			base.OnPaint(e);
			Graphics g = e.Graphics;

			if (this.Image != null)
			{
				Rectangle imageBounds = this.ClientRectangle;

				switch (this.DisplayMode)
				{
					case NuGenDisplayMode.ActualSize:
					{
						if (this.AutoScrollPosition.X == 0
							&& this.AutoScrollPosition.Y == 0
							&& this.AutoScrollMinSize.Width <= this.ClientRectangle.Width
							&& this.AutoScrollMinSize.Height <= this.ClientRectangle.Height
							)
						{
							imageBounds = NuGenControlPaint.ImageBoundsFromContentAlignment(
								this.Image.Size
								, this.ClientRectangle
								, this.ImageAlign
							);
						}
						else
						{
							imageBounds = new Rectangle(
								this.AutoScrollPosition.X
								, this.AutoScrollPosition.Y
								, this.Image.Width
								, this.Image.Height
							);
						}

						break;
					}
					case NuGenDisplayMode.Zoom:
					{
						imageBounds = new Rectangle(
							(int)(this.AutoScrollPosition.X / _zoomFactor)
							, (int)(this.AutoScrollPosition.Y / _zoomFactor)
							, (int)(this.Image.Width * _zoomFactor)
							, (int)(this.Image.Height * _zoomFactor)
						);
						float zoomFactor = (float)_zoomFactor;
						g.ScaleTransform(zoomFactor, zoomFactor);
						break;
					}
					case NuGenDisplayMode.ScaleToFit:
					{
						imageBounds = NuGenControlPaint.ScaleToFit(this.ClientRectangle, this.Image.Size);
						break;
					}
				}

				NuGenImagePaintParams imagePaintParams = new NuGenImagePaintParams(g);
				imagePaintParams.Bounds = imageBounds;
				imagePaintParams.Image = this.Image;
				imagePaintParams.State = this.StateTracker.GetControlState();

				this.Renderer.DrawImage(imagePaintParams);
			}
		}
Пример #17
0
		/*
		 * OnPaint
		 */

		/// <summary>
		/// Raises the paint event.
		/// </summary>
		/// <param name="e">The <see cref="System.Windows.Forms.PaintEventArgs"/> instance containing the event data.</param>
		protected override void OnPaint(PaintEventArgs e)
		{
			Graphics g = e.Graphics;
			Rectangle bounds = this.ClientRectangle;
			NuGenControlState currentState = this.ButtonStateTracker.GetControlState();
			Image image = this.Image;
			ContentAlignment imageAlign = this.ImageAlign;
			Rectangle imageBounds = Rectangle.Empty;

			if (image != null)
			{
				NuGenImagePaintParams imagePaintParams = new NuGenImagePaintParams(g);
				imagePaintParams.Bounds = imageBounds = this.LayoutManager.GetImageBounds(
					new NuGenBoundsParams(
						bounds
						, imageAlign
						, new Rectangle(Point.Empty, image.Size)
						, this.RightToLeft
					)
				);
				imagePaintParams.Image = image;
				imagePaintParams.State = currentState;

				this.Renderer.DrawImage(imagePaintParams);
			}

			NuGenTextPaintParams textPaintParams = new NuGenTextPaintParams(g);

			textPaintParams.Bounds = this.LayoutManager.GetTextBounds(
				new NuGenBoundsParams(
					bounds
					, imageAlign
					, imageBounds
					, this.RightToLeft
				)
			);
			textPaintParams.Font = this.Font;
			textPaintParams.ForeColor = this.ForeColor;
			textPaintParams.Text = this.Text;
			textPaintParams.TextAlign = NuGenControlPaint.RTLContentAlignment(this.TextAlign, this.RightToLeft);
			textPaintParams.State = currentState;

			this.Renderer.DrawText(textPaintParams);
		}
Пример #18
0
		/*
		 * OnPaint
		 */

		/// <summary>
		/// Raises the <see cref="E:System.Windows.Forms.Control.Paint"></see> event.
		/// </summary>
		/// <param name="e">A <see cref="T:System.Windows.Forms.PaintEventArgs"></see> that contains the event data.</param>
		protected override void OnPaint(PaintEventArgs e)
		{
			Debug.Assert(this.ButtonStateTracker != null, "this.ButtonStateTracker != null");
			Debug.Assert(this.Renderer != null, "this.Renderer != null");

			Graphics g = e.Graphics;
			NuGenControlState currentState = this.ButtonStateTracker.GetControlState();
			Rectangle bounds = this.ClientRectangle;
			Rectangle contentBounds = this.LayoutManager.GetContentRectangle(bounds);

			NuGenPaintParams paintParams = new NuGenPaintParams(g);
			paintParams.Bounds = bounds;
			paintParams.State = currentState;

			this.Renderer.DrawBackground(paintParams);
			this.Renderer.DrawShadow(paintParams);
			this.Renderer.DrawBorder(paintParams);

			Image image = this.Image;
			Rectangle imageBounds = Rectangle.Empty;
			ContentAlignment imageAlign = this.ImageAlign;

			if (image != null)
			{
				NuGenImagePaintParams imagePaintParams = new NuGenImagePaintParams(g);
				imagePaintParams.Bounds = imageBounds = this.LayoutManager.GetImageBounds(
					new NuGenBoundsParams(
						contentBounds
						, imageAlign
						, new Rectangle(Point.Empty, image.Size)
						, this.RightToLeft
						)
					);
				imagePaintParams.Image = image;
				imagePaintParams.State = currentState;

				this.Renderer.DrawImage(imagePaintParams);
			}

			if (imageBounds != Rectangle.Empty)
			{
				imageBounds.Inflate(3, 3);
			}

			NuGenTextPaintParams textPaintParams = new NuGenTextPaintParams(g);

			textPaintParams.Bounds = this.LayoutManager.GetTextBounds(
				new NuGenBoundsParams(contentBounds, imageAlign, imageBounds, this.RightToLeft)
			);
			textPaintParams.Font = this.Font;
			textPaintParams.ForeColor = this.ForeColor;
			textPaintParams.Text = this.Text;
			textPaintParams.TextAlign = NuGenControlPaint.RTLContentAlignment(this.TextAlign, this.RightToLeft);
			textPaintParams.State = currentState;

			this.Renderer.DrawText(textPaintParams);
		}
Пример #19
0
        /// <summary>
        /// Raises the <see cref="E:System.Windows.Forms.Control.Paint"></see> event.
        /// </summary>
        /// <param name="e">A <see cref="T:System.Windows.Forms.PaintEventArgs"></see> that contains the event data.</param>
        protected override void OnPaint(PaintEventArgs e)
        {
            Graphics  g      = e.Graphics;
            Rectangle bounds = this.ClientRectangle;

            if (this.Orientation == NuGenOrientationStyle.Horizontal)
            {
                bounds.X++;
                bounds.Width -= 2;
            }
            else
            {
                bounds.Y++;
                bounds.Height -= 2;
            }

            Rectangle         contentBounds = this.LayoutManager.GetContentRectangle(bounds);
            NuGenControlState currentState  = this.ButtonStateTracker.GetControlState();

            NuGenPaintParams paintParams = new NuGenPaintParams(e.Graphics);

            paintParams.Bounds = bounds;
            paintParams.State  = currentState;

            if (currentState != NuGenControlState.Normal)
            {
                this.Renderer.DrawBackground(paintParams);

                NuGenPaintParams borderPaintParams = new NuGenPaintParams(paintParams);
                borderPaintParams.Bounds = NuGenControlPaint.BorderRectangle(borderPaintParams.Bounds);
                this.Renderer.DrawBorder(borderPaintParams);
            }

            Image            image       = this.Image;
            Rectangle        imageBounds = Rectangle.Empty;
            ContentAlignment imageAlign  = this.ImageAlign;

            if (image != null)
            {
                NuGenImagePaintParams imagePaintParams = new NuGenImagePaintParams(g);
                imagePaintParams.Bounds = imageBounds = this.LayoutManager.GetImageBounds(
                    new NuGenBoundsParams(contentBounds
                                          , imageAlign
                                          , new Rectangle(Point.Empty, image.Size)
                                          , this.RightToLeft
                                          )
                    );
                imagePaintParams.Image = image;
                imagePaintParams.State = currentState;

                this.Renderer.DrawImage(imagePaintParams);
            }

            if (imageBounds != Rectangle.Empty)
            {
                imageBounds.Inflate(3, 3);
            }

            NuGenTextPaintParams textPaintParams = new NuGenTextPaintParams(g);

            textPaintParams.Bounds = this.LayoutManager.GetTextBounds(
                new NuGenBoundsParams(contentBounds, imageAlign, imageBounds, this.RightToLeft)
                );
            textPaintParams.Font      = this.Font;
            textPaintParams.ForeColor = this.ForeColor;
            textPaintParams.Text      = this.Text;
            textPaintParams.TextAlign = NuGenControlPaint.RTLContentAlignment(this.TextAlign, this.RightToLeft);
            textPaintParams.State     = currentState;

            this.Renderer.DrawText(textPaintParams);
        }