Beispiel #1
0
        public override void drawWithAngle(ToolSettings toolsettings, Point mid)
        {
            Matrix matrix = new Matrix();

            matrix.RotateAt((float)(angleIn), mid);
            Graphics g = Graphics.FromImage(toolsettings.bitmap);

            g.Transform = matrix;

            g.SmoothingMode     = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
            g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.High;

            List <Point> pointRect;

            pointRect = ParallelogramTool.get4PointRectangleFrom2Point(startPoint, endPoint);
            pointRect = ParallelogramTool.get4PointParallelogramFromRectangle(pointRect, alpha);


            Brush fill = getBrush();

            g.FillPolygon(fill, pointRect.ToArray());

            Pen pen = new Pen(new SolidBrush(outlineColor), width);

            pen.DashStyle = lineStyle;
            //draw the new rect
            g.DrawPolygon(pen, pointRect.ToArray());
            toolsettings.pictureBox.Invalidate();


            matrix.RotateAt(-(float)(angleIn), mid);
            g.Transform = matrix;
        }
Beispiel #2
0
        public bool checkNearParallelPoint(Point p)
        {
            List <Point> pointRect = ParallelogramTool.get4PointRectangleFrom2Point(startPoint, endPoint);

            pointRect = ParallelogramTool.get4PointParallelogramFromRectangle(pointRect, alpha);
            Point point = pointRect[1];

            if (Math.Abs(p.X - point.X) < 5 && Math.Abs(p.Y - point.Y) < 5)
            {
                return(true);
            }
            return(false);
        }
Beispiel #3
0
        public override void drawAllPointToShape(ToolSettings toolSettings, int sizeControlPoint)
        {
            base.drawAllPointToShape(toolSettings, sizeControlPoint);
            List <Point> pointRect = ParallelogramTool.get4PointRectangleFrom2Point(startPoint, endPoint);

            pointRect = ParallelogramTool.get4PointParallelogramFromRectangle(pointRect, alpha);
            Point point = new Point(pointRect[1].X, pointRect[1].Y);

            point = rotatePoint(point, angleIn, getMid());

            Pen pen = new Pen(Color.Yellow, sizeControlPoint);

            Graphics.FromImage(toolSettings.bitmap).DrawRectangle(pen, point.X, point.Y, sizeControlPoint, sizeControlPoint);
            toolSettings.pictureBox.Invalidate();
        }