Exemplo n.º 1
0
        private void Render()
        {
            float  height = scrh * Zoom;
            float  wight  = scrw * Zoom;
            Bitmap bmp    = new Bitmap((int)(scrw * Zoom), (int)(scrh * Zoom));

            Matrix = new Matrix();
            Matrix.Scale(Zoom, Zoom);
            List <GraphicsPath> grUp = new List <GraphicsPath>();

            GrUpped.ToList().ForEach(p => grUp.Add((GraphicsPath)p.Clone()));
            List <GraphicsPath> grNo = new List <GraphicsPath>();

            GrNormal.ToList().ForEach(p => grNo.Add((GraphicsPath)p.Clone()));
            foreach (var item in grUp)
            {
                item.Transform(Matrix);
            }
            foreach (var item in grNo)
            {
                item.Transform(Matrix);
            }
            using (Graphics gr = Graphics.FromImage(bmp))
            {
                gr.FillRectangle(Brushes.White, new RectangleF(0, 0, wight, height));
                if (MacroBmp != null)
                {
                    gr.DrawImage(MacroBmp, 0, 0,
                                 main.PicSize.Width * Zoom / .013f,
                                 main.PicSize.Height * Zoom / .013f);
                }
                gr.DrawRectangle(PenRectangle, 2, 2, wight - 4, height - 4);
                foreach (var item in grUp)
                {
                    gr.DrawPath(new Pen(Color.Gray, 1 * Zoom)
                    {
                        DashStyle = DashStyle.Dash
                    }, item);
                }
                foreach (var item in grNo)
                {
                    gr.DrawPath(new Pen(Color.Black, 1 * Zoom), item);
                }
            }
            Image img = pictureBox1.Image;

            pictureBox1.Image = bmp;
            if (img != null)
            {
                img.Dispose();
            }
        }
Exemplo n.º 2
0
        private void Render()
        {
            int    height            = pictureBox1.Height;
            int    width             = pictureBox1.Width;
            Bitmap bmp               = new Bitmap(width, height);
            List <GraphicsPath> grUp = new List <GraphicsPath>();

            GrUpped.ToList().ForEach(p => grUp.Add((GraphicsPath)p.Clone()));
            List <GraphicsPath> grNo = new List <GraphicsPath>();

            GrNormal.ToList().ForEach(p => grNo.Add((GraphicsPath)p.Clone()));
            var Matrix = new Matrix();

            Matrix.Scale(Zoom, Zoom);
            foreach (var item in grUp)
            {
                item.Transform(Matrix);
            }
            foreach (var item in grNo)
            {
                item.Transform(Matrix);
            }
            using (Graphics gr = Graphics.FromImage(bmp))
            {
                gr.FillRectangle(Brushes.White, new RectangleF(0, 0, width, height));
                gr.DrawRectangle(new Pen(Color.Black, 1)
                {
                    DashStyle = DashStyle.Dot
                }, 2, 2, width - 4, height - 4);
                foreach (var item in grUp)
                {
                    gr.DrawPath(new Pen(Color.Gray, 1)
                    {
                        DashStyle = DashStyle.Dash
                    }, item);
                }
                foreach (var item in grNo)
                {
                    gr.DrawPath(new Pen(Color.Black, 1), item);
                }
            }
            Image img = pictureBox1.Image;

            pictureBox1.Image = bmp;
            if (img != null)
            {
                img.Dispose();
            }
        }