Пример #1
0
        public void DrawShap()
        {
            Graphics g = bGrp.Graphics;

            g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
            g.Clear(Color.Black);
            Rectangle rectangle = this.ClientRectangle;

            var initContainer = g.BeginContainer();

            g.Transform = initMatrix;// new Matrix(1, 0, 0, -1, rectangle.Width / 2, rectangle.Height / 2);
            //g.TranslateTransform(rectangle.Width / 2, rectangle.Height / 2);
            float      r    = 150;
            RectangleF rect = new RectangleF(-r, -r, 2 * r, 2 * r);

            g.DrawEllipse(Pens.Red, rect);

            GraphicsContainer drawContainer = g.BeginContainer();

            g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;

            penWidth = 2 / globalZoomNum;
            Pen pen = new Pen(Color.White, penWidth);

            g.TranslateTransform(r / 2, 0);
            g.DrawEllipse(pen, -r / 2, -r / 2, r, r);
            g.EndContainer(drawContainer);

            drawContainer   = g.BeginContainer();
            g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
            g.TranslateTransform(-r / 2, 0);
            g.DrawEllipse(Pens.Yellow, -r / 2, -r / 2, r, r);
            g.EndContainer(drawContainer);

            drawContainer   = g.BeginContainer();
            g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
            g.TranslateTransform(0, -r / 2);
            g.DrawEllipse(Pens.Blue, -r / 2, -r / 2, r, r);
            g.EndContainer(drawContainer);

            drawContainer   = g.BeginContainer();
            g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
            g.TranslateTransform(0, r / 2);
            g.DrawEllipse(Pens.Purple, -r / 2, -r / 2, r, r);
            g.EndContainer(drawContainer);

            g.EndContainer(initContainer);
            g.DrawRectangle(Pens.Red, 0, 0, 50, 50);
            bGrp.Render();
        }
Пример #2
0
        void DrawShape(Graphics g)
        {
            g.Clear(Color.Transparent);
            g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;

            g.Transform = UserMatrix.initMatrix;

            GraphicsContainer drawContainer = g.BeginContainer();

            g.ScaleTransform(1 / GlobalZoomNum, 1 / GlobalZoomNum);

            CoordinateShape.Draw(g);
            MouseShape.Draw(g);
            g.EndContainer(drawContainer);
        }