Exemplo n.º 1
0
        protected override void Draw2D(Pi2PictureBox box, Graphics g, Graphics pickGraphics)
        {
            if (ControlPoints.Count >= 2)
            {
                Vec2 p1 = box.PictureToScreen(ControlPoints[0].GetXY());
                Vec2 p2 = box.PictureToScreen(ControlPoints[1].GetXY());

                float x = (float)Math.Min(p1.X, p2.X);
                float y = (float)Math.Min(p1.Y, p2.Y);
                float w = (float)Math.Abs(p2.X - p1.X);
                float h = (float)Math.Abs(p2.Y - p1.Y);

                using (Pen pen = new Pen(Color, (float)LineWidth))
                {
                    g.DrawRectangle(pen, x, y, w, h);

                    if (DrawCenterCross)
                    {
                        float s  = 20;
                        float cx = x + w / 2.0f;
                        float cy = y + h / 2.0f;
                        pen.DashStyle = CenterCrossStyle;
                        g.DrawLine(pen, cx, y - s, cx, y + h + s);
                        g.DrawLine(pen, x - s, cy, x + w + s, cy);
                    }
                }



                using (Pen pen = box.GetPickPen(this))
                    pickGraphics.DrawRectangle(pen, x, y, w, h);
            }
        }
Exemplo n.º 2
0
        protected override void Draw2D(Pi2PictureBox box, Graphics g, Graphics pickGraphics)
        {
            if (ControlPoints.Count >= 2)
            {
                Vec2 p1 = box.PictureToScreen(ControlPoints[0].GetXY());
                Vec2 p2 = box.PictureToScreen(ControlPoints[1].GetXY());

                using (Pen pen = new Pen(Color, (float)LineWidth))
                    g.DrawLine(pen, p1.ToPointF(), p2.ToPointF());

                using (Pen pen = box.GetPickPen(this))
                    pickGraphics.DrawLine(pen, p1.ToPointF(), p2.ToPointF());
            }
        }
Exemplo n.º 3
0
        protected override void Draw2D(Pi2PictureBox box, Graphics g, Graphics pickGraphics)
        {
            Vec2 p1 = box.PictureToScreen(new Vec2(box.OriginalWidth / 2.0, 0));
            Vec2 p2 = box.PictureToScreen(new Vec2(box.OriginalWidth / 2.0, box.OriginalHeight));

            Vec2 p3 = box.PictureToScreen(new Vec2(0, box.OriginalHeight / 2.0));
            Vec2 p4 = box.PictureToScreen(new Vec2(box.OriginalWidth, box.OriginalHeight / 2.0));

            using (Pen pen = new Pen(Color, (float)LineWidth))
            {
                g.DrawLine(pen, p1.ToPointF(), p2.ToPointF());
                g.DrawLine(pen, p3.ToPointF(), p4.ToPointF());
            }

            using (Pen pen = box.GetPickPen(this))
            {
                pickGraphics.DrawLine(pen, p1.ToPointF(), p2.ToPointF());
                pickGraphics.DrawLine(pen, p3.ToPointF(), p4.ToPointF());
            }
        }