Ejemplo n.º 1
0
        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);

            if (metafile_ == null)
            {
                return;
            }

            var imageRectangle = Imaging.ImageRectangleFromSizeMode(
                metafile_, ClientRectangle, sizeMode_, Padding);

            e.Graphics.DrawImage(metafile_, imageRectangle);
        }
Ejemplo n.º 2
0
        private void Render()
        {
            lock (canvasLock_)
            {
                if (canvas_ == null)
                {
                    return;
                }

                using (var graphics = Graphics.FromImage(canvas_))
                {
                    var imageRectangle = Imaging.ImageRectangleFromSizeMode(
                        metafile_, new Rectangle(0, 0, canvas_.Width, canvas_.Height), sizeMode_, Padding);
                    graphics.DrawImage(metafile_, imageRectangle);
                }
            }
        }