ZForge.Controls.ExplorerBar.TaskItem.OnPaint C# (CSharp) 메소드

OnPaint() 보호된 메소드

Raises the Paint event
protected OnPaint ( PaintEventArgs e ) : void
e PaintEventArgs A PaintEventArgs that contains the event data
리턴 void
        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaintBackground(e);

            //base.OnPaint(e);

            // do we have an image to draw
            if (this.Image != null)
            {
                if (this.Enabled)
                {
                    if (this.RightToLeft == RightToLeft.Yes)
                    {
                        e.Graphics.DrawImage(this.Image, this.Width-16, 0, 16, 16);
                    }
                    else
                    {
                        e.Graphics.DrawImage(this.Image, 0, 0, 16, 16);
                    }
                }
                else
                {
                    // fix: use ControlPaint.DrawImageDisabled() to draw
                    //      the disabled image
                    //      Brad Jones ([email protected])
                    //      26/08/2004
                    //      v1.3

                    if (this.RightToLeft == RightToLeft.Yes)
                    {
                        ControlPaint.DrawImageDisabled(e.Graphics, this.Image, this.Width-16, 0, this.BackColor);
                    }
                    else
                    {
                        ControlPaint.DrawImageDisabled(e.Graphics, this.Image, 0, 0, this.BackColor);
                    }
                }
            }

            // do we have any text to draw
            if (this.Text.Length > 0)
            {
                if (this.textRect.Width == 0 && this.textRect.Height == 0)
                {
                    this.textRect.X = 0;
                    this.textRect.Y = 0;
                    this.textRect.Height = this.PreferredHeight;

                    if (this.RightToLeft == RightToLeft.Yes)
                    {
                        this.textRect.Width = this.Width - this.Padding.Right;

                        if (this.Image != null)
                        {
                            this.textRect.Width -= 16;
                        }
                    }
                    else
                    {
                        if (this.Image != null)
                        {
                            this.textRect.X = 16 + this.Padding.Left;
                        }

                        this.textRect.Width = this.Width - this.textRect.X - this.Padding.Right;
                    }
                }

                if (this.RightToLeft == RightToLeft.Yes)
                {
                    this.stringFormat.FormatFlags |= StringFormatFlags.DirectionRightToLeft;
                    this.drawTextFlags |= DrawTextFlags.DT_RTLREADING;
                }
                else
                {
                    this.stringFormat.FormatFlags &= ~StringFormatFlags.DirectionRightToLeft;
                    this.drawTextFlags &= ~DrawTextFlags.DT_RTLREADING;
                }

                if (this.UseGdiText)
                {
                    this.DrawGdiText(e.Graphics);
                }
                else
                {
                    this.DrawText(e.Graphics);
                }
            }

            // check if windows will let us show a focus rectangle
            // if we have focus
            if (this.Focused && base.ShowFocusCues)
            {
                if (this.ShowFocusCues)
                {
                    ControlPaint.DrawFocusRectangle(e.Graphics, this.ClientRectangle);
                }
            }
        }