Beispiel #1
0
        private void plMain_Paint(object sender, PaintEventArgs e)
        {
            if (statusPaint.isStart == true)
            {
                lShape.ForEach(shape =>
                {
                    using (GraphicsPath path = shape.graphicsPath)

                    {
                        shape.draw(e);
                        if (shape.isSelected == true)
                        {
                            if (shape is Ellipse)
                            {
                                e.Graphics.DrawRectangle(framPen, shape.p1.X, shape.p1.Y, Math.Abs(shape.p2.X - shape.p1.X), Math.Abs(shape.p2.Y - shape.p1.Y));
                                //FindRegion.drawPointControl(e.Graphics, framBrush, shape);
                            }
                            else if (shape is Circle)
                            {
                                e.Graphics.DrawPath(framPen, FindRegion.framOfCircle(shape as Circle));
                            }

                            else if (shape is Curve || shape is Polygon)
                            {
                                for (int i = 0; i < shape.lPoint.Count; i++)
                                {
                                    e.Graphics.FillEllipse(framBrush, shape.lPoint[i].X - 3, shape.lPoint[i].Y - 3, 8, 8);
                                }
                            }

                            else if (shape is lPen)
                            {
                                // Không thực hiện chọn
                            }

                            else if (shape is GroupShape)
                            {
                                using (GraphicsPath pathG = shape.graphicsPath)
                                {
                                    e.Graphics.DrawPath(framPen, FindRegion.framOfGroup(shape as GroupShape));
                                }
                            }

                            FindRegion.drawPointControl(e.Graphics, framBrush, shape);
                        }
                        else
                        {
                            shape.draw(e);
                        }
                    }
                }
                               );
                this.plMain.Focus();
            }
        }