예제 #1
0
        public void DrawImage(Graphics g, Rectangle destRect)
        {
            if (Image == null)
            {
                return;
            }

            DrawUtil.DrawImage(g, Image, destRect, SizeMode, StretchMargins);
        }
예제 #2
0
        protected override void OnPaintBackground(PaintEventArgs e)
        {
            base.OnPaintBackground(e);

            if (ActiveFormStyle == null || ActiveFormStyle.NormalState.Image == null)
            {
                return;
            }

            Rectangle srcRect =
                DrawUtil.ExcludePadding(new Rectangle(Point.Empty, ActiveFormStyle.NormalState.Image.Size),
                                        ActiveFormStyle.ClientAreaPadding);

            Padding margins =
                DrawUtil.SubstractPadding(ActiveFormStyle.NormalState.StretchMargins, ActiveFormStyle.ClientAreaPadding);

            DrawUtil.DrawImage(e.Graphics, ActiveFormStyle.NormalState.Image, srcRect, ClientRectangle, null, margins);
        }