protected override void OnPaint(PaintEventArgs e)
        {
            DrawBackGround(e.Graphics);
            ProtoFrameControlHelp.DrawBorder(e.Graphics, this.ClientRectangle, Color.Black);
            if (Bitmap == null)
            {
                return;
            }
            Rectangle rect = SrcRect;

            if (SrcRect.Width == 0 && SrcRect.Height == 0)
            {
                rect = new Rectangle(new Point(0, 0), bitmap.Size);
            }
            int x = 0, y = 0;

            if (ImageAlignCenter)
            {
                x = (int)(e.Graphics.ClipBounds.Width - rect.Width) / 2;
                y = (int)(e.Graphics.ClipBounds.Height - rect.Height) / 2;
            }
            else
            {
                x = ((bitmap.Width) - bitmap.Width) / 2;
                y = ((bitmap.Height) - bitmap.Height) / 2;
            }
            if (Scale)
            {
                e.Graphics.DrawImage(bitmap, e.ClipRectangle, rect, GraphicsUnit.Pixel);
            }
            else
            {
                e.Graphics.DrawImage(bitmap, new Rectangle(x, y, rect.Width, rect.Height), rect, GraphicsUnit.Pixel);
            }
            if (this.UseRectangleFocus && this.Focused)
            {
                ProtoFrameControlHelp.DrawFocusRectangle(e.Graphics, e.ClipRectangle);
            }
        }
Exemple #2
0
 protected virtual void DrawBorder(PaintEventArgs e)
 {
     ProtoFrameControlHelp.DrawBorder(e.Graphics, e.ClipRectangle, Color.Black);
 }