DrawClosedCurve() public method

public DrawClosedCurve ( Pen pen, Point points ) : void
pen Pen
points Point
return void
コード例 #1
0
        /// <summary>
        /// Draws the shape.
        /// </summary>
        /// <param name="G">The g.</param>
        /// <param name="FillShape">The fill shape.</param>
        /// <param name="DrawShape">The draw shape.</param>
        /// <exception cref="ArgumentOutOfRangeException">
        /// FillModes - null
        /// or
        /// FillModes - null
        /// or
        /// ShapeTypes - null
        /// </exception>
        public void DrawShape(System.Drawing.Graphics G, Brush FillShape, Pen DrawShape)
        {
            foreach (List <Point> points in Points)
            {
                switch (ShapeType)
                {
                case ShapeTypes.Polygon:
                    switch (FillMode)
                    {
                    case FillModes.Fill:
                        G.FillPolygon(FillShape, points.ToArray());
                        break;

                    case FillModes.Border:
                        G.DrawPolygon(DrawShape, points.ToArray());
                        break;

                    case FillModes.Both:
                        G.FillPolygon(FillShape, points.ToArray());
                        G.DrawPolygon(DrawShape, points.ToArray());
                        break;

                    default:
                        throw new ArgumentOutOfRangeException(nameof(FillModes), FillMode, null);
                    }

                    break;

                case ShapeTypes.Spline:
                    switch (FillMode)
                    {
                    case FillModes.Fill:
                        G.FillClosedCurve(FillShape, points.ToArray());
                        break;

                    case FillModes.Border:
                        G.DrawClosedCurve(DrawShape, points.ToArray());
                        break;

                    case FillModes.Both:
                        G.FillClosedCurve(FillShape, points.ToArray());
                        G.DrawClosedCurve(DrawShape, points.ToArray());
                        break;

                    default:
                        throw new ArgumentOutOfRangeException(nameof(FillModes), FillMode, null);
                    }

                    break;

                default:
                    throw new ArgumentOutOfRangeException(nameof(ShapeTypes), ShapeType, null);
                }
            }
        }
コード例 #2
0
 public override void OnDraw(System.Drawing.Graphics g)
 {
     try
     {
         if (pts != null)
         {
             System.Drawing.Pen pen = new System.Drawing.Pen(Color, width);
             if (pts.Length > 2)
             {
                 g.DrawClosedCurve(pen, pts, tension, FillMode.Winding);
                 if (fill)
                 {
                     g.FillClosedCurve(new System.Drawing.SolidBrush(fillColor), pts, FillMode.Winding, tension);
                 }
             }
             else if (pts.Length > 1)
             {
                 g.DrawCurve(pen, pts);
             }
             if ((pts.Length == 1 || pts.Length == 2) && step >= 0)
             {
                 g.DrawLine(pen, pts[pts.Length - 1], ptNew);
             }
         }
     }
     catch
     {
     }
 }
コード例 #3
0
        public override void Draw(RectangleF rect)
        {
            Graphics g = new Graphics();

            //g.Clear(Color.White);
            g.SmoothingMode = SmoothingMode.AntiAlias;
            // Create a pen object:
            Pen aPen = new Pen(Color.Blue, 2);
            // Create a brush object with a transparent red color:
            SolidBrush aBrush = new SolidBrush(Color.Red);
            HatchBrush hBrush = new HatchBrush(HatchStyle.Shingle, Color.Blue, Color.LightCoral);
            HatchBrush hBrush2 = new HatchBrush(HatchStyle.Cross, Color.Blue, Color.LightCoral);
            HatchBrush hBrush3 = new HatchBrush(HatchStyle.BackwardDiagonal, Color.Blue, Color.LightCoral);
            HatchBrush hBrush4 = new HatchBrush(HatchStyle.Sphere, Color.Blue, Color.LightCoral);

            // Draw a rectangle:
            g.DrawRectangle(aPen, 20, 20, 100, 50);
            // Draw a filled rectangle:
            g.FillRectangle(hBrush, 20, 90, 100, 50);
            // Draw ellipse:
            g.DrawEllipse(aPen, new Rectangle(20, 160, 100, 50));
            // Draw filled ellipse:
            g.FillEllipse(hBrush2, new Rectangle(170, 20, 100, 50));
            // Draw arc:
            g.DrawArc(aPen, new Rectangle(170, 90, 100, 50), -90, 180);

            // Draw filled pie pieces
            g.FillPie(aBrush, new Rectangle(170, 160, 100, 100), -90, 90);
            g.FillPie(hBrush4, new Rectangle(170, 160, 100, 100), -90, -90);

            // Create pens.
            Pen redPen   = new Pen(Color.Red, 3);
            Pen greenPen = new Pen(Color.Green, 3);
            greenPen.DashStyle = DashStyle.DashDotDot;
            SolidBrush transparentBrush = new SolidBrush(Color.FromArgb(150, Color.Wheat));

            // define point array to draw a curve:
            Point point1 = new Point(300, 250);
            Point point2 = new Point(350, 125);
            Point point3 = new Point(400, 110);
            Point point4 = new Point(450, 210);
            Point point5 = new Point(500, 300);
            Point[] curvePoints ={ point1, point2, point3, point4, point5};

            // Draw lines between original points to screen.
            g.DrawLines(redPen, curvePoints);

            // Fill Curve
            g.FillClosedCurve(transparentBrush, curvePoints);

            // Draw closed curve to screen.
            g.DrawClosedCurve(greenPen, curvePoints);

            g.Dispose();
        }
コード例 #4
0
        public void DrawClosedCurve(Pen pen, PointD[] points, double tension, FillMode fillMode, bool fill = false)
        {
            if (pen == null)
            {
                throw new ArgumentNullException("pen");
            }
            if (points == null)
            {
                throw new ArgumentNullException("points");
            }

            lock (bitmapLock) {
                double maxX = 0.0d;
                double maxY = 0.0d;

                for (long i = 0L; i < points.LongLength; i++)
                {
                    if (points[i].X * tension > maxX)
                    {
                        maxX = points[i].X * tension;
                    }
                    if (points[i].Y * tension > maxY)
                    {
                        maxY = points[i].Y * tension;
                    }
                }

                TryExpand(0.0d, 0.0d, maxX, maxY, pen.Width);
                using (System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(bitmap)) {
                    g.SmoothingMode = (Antialiasing) ? SmoothingMode.AntiAlias : SmoothingMode.None;
                    if (fill)
                    {
                        g.FillClosedCurve(pen.Brush, ToPointFArray(points), fillMode, (float)tension);
                    }
                    else
                    {
                        g.DrawClosedCurve(pen, ToPointFArray(points), (float)tension, fillMode);
                    }
                }
                Texturize();
            }
        }
コード例 #5
0
        private void DrawOne(Graphics g, int xmin, int xmax, int ymin, int ymax)
        {
            var shape = Shape.Arc;
            var color = new Color();
            var randomValue = RandomProvider.RandomGenerator.NextDouble();
            foreach (var probabilitiesOfShape in ProbabilitiesOfShapes)
            {
                if (randomValue < probabilitiesOfShape.Probability)
                {
                    shape = probabilitiesOfShape.Value;
                    break;
                }
            }

            randomValue = RandomProvider.RandomGenerator.NextDouble();

            foreach (var colorProbabilityPair in colorsCDFs)
            {
                if (randomValue < colorProbabilityPair.probability)
                {
                    color = colorProbabilityPair.color;
                    break;
                }
            }

            var pen = new Pen(color);

            var x1 = RandomProvider.RandomGenerator.Next(xmin, xmax + 1);
            var y1 = RandomProvider.RandomGenerator.Next(ymin, ymax + 1);

            var x2 = RandomProvider.RandomGenerator.Next(xmin, xmax + 1);
            var y2 = RandomProvider.RandomGenerator.Next(ymin, ymax + 1);

            var x3 = RandomProvider.RandomGenerator.Next(xmin, xmax + 1);
            var y3 = RandomProvider.RandomGenerator.Next(ymin, ymax + 1);

            var x4 = RandomProvider.RandomGenerator.Next(xmin, xmax + 1);
            var y4 = RandomProvider.RandomGenerator.Next(ymin, ymax + 1);

            var w1 = RandomProvider.RandomGenerator.Next(x1, xmax + 1);
            var h1 = RandomProvider.RandomGenerator.Next(y1, ymax + 1);

            var angle1 = RandomProvider.RandomGenerator.Next(0, 360);

            switch (shape)
            {
                case Shape.Arc:
                    g.DrawArc(pen, x1, y1, w1, h1, RandomProvider.RandomGenerator.Next(0, 360),
                        RandomProvider.RandomGenerator.Next(0, 360));
                    break;
                case Shape.Bezier:
                    g.DrawBezier(pen, x1, y1, x2, y2, x3, y3, x4, y4);
                    break;
                case Shape.ClosedCurve:
                    g.DrawClosedCurve(pen,
                        new[] {new PointF(x1, y1), new PointF(x2, y2), new PointF(x3, y3), new PointF(x4, y4)});
                    break;
                case Shape.Curve:
                    g.DrawCurve(pen,
                        new[] {new PointF(x1, y1), new PointF(x2, y2), new PointF(x3, y3), new PointF(x4, y4)});
                    break;
                case Shape.Ellipse:
                    g.DrawEllipse(pen, x1, y1, w1, h1);
                    break;
                case Shape.Line:
                    g.DrawLine(pen, x1, y1, x2, y2);
                    break;
                case Shape.Lines:
                    g.DrawLines(pen,
                        new[] {new PointF(x1, y1), new PointF(x2, y2), new PointF(x3, y3), new PointF(x4, y4)});
                    break;
                case Shape.Pie:
                    g.DrawPie(pen, x1, y1, w1, h1, RandomProvider.RandomGenerator.Next(0, 360),
                        RandomProvider.RandomGenerator.Next(0, 360));
                    break;
                case Shape.Polygon:
                    g.DrawPolygon(pen,
                        new[] {new PointF(x1, y1), new PointF(x2, y2), new PointF(x3, y3), new PointF(x4, y4)});
                    break;
                case Shape.Rectangle:
                    g.DrawRectangle(pen, x1, y1, w1, h1);
                    break;
                case Shape.String:
                    g.DrawString(EnglishWordsDictionary.GetRandomWord(),
                        new Font("Cambria", RandomProvider.RandomGenerator.Next(1, 50)), new SolidBrush(color),
                        new PointF(x1, y1));
                    break;
                case Shape.FillClosedCurve:
                    g.FillClosedCurve(new SolidBrush(color),
                        new[] {new PointF(x1, y1), new PointF(x2, y2), new PointF(x3, y3), new PointF(x4, y4)});
                    break;
                case Shape.FillEllipse:
                    g.FillEllipse(new SolidBrush(color), x1, y1, w1, h1);
                    break;
                case Shape.FillPie:
                    g.FillPie(new SolidBrush(color), x1, y1, w1, h1, RandomProvider.RandomGenerator.Next(0, 360),
                        RandomProvider.RandomGenerator.Next(0, 360));
                    break;
                case Shape.FillPolygon:
                    g.FillPolygon(new SolidBrush(color),
                        new[] {new PointF(x1, y1), new PointF(x2, y2), new PointF(x3, y3), new PointF(x4, y4)});
                    break;
                case Shape.FillRectangle:
                    g.FillRectangle(new SolidBrush(color), x1, y1, w1, h1);
                    break;
                default:
                    throw new ArgumentOutOfRangeException();
            }
            // g.Save();
        }
コード例 #6
0
ファイル: DefaultPartRenderer.cs プロジェクト: vlapchenko/nfx
    public void Balloon(Graphics gr,
                  Rectangle rect,
                  Point target,
                  Color color,
                  IFieldControlContext context)
    {
      Point[] balloon = VectorUtils.VectorizeBalloon(rect, target, Math.PI / 8);
      
      gr.SmoothingMode = SmoothingMode.AntiAlias;
            
      using (LinearGradientBrush br =
              new LinearGradientBrush(rect, Color.White, color, LinearGradientMode.ForwardDiagonal)
             )
      {
        br.WrapMode = WrapMode.TileFlipXY;
        
        gr.FillClosedCurve(br, balloon, FillMode.Alternate, 0.08f);
      }

      gr.DrawClosedCurve(Pens.Black, balloon, 0.08f, FillMode.Alternate);
    }
コード例 #7
0
		/// <summary>
		/// Draws the temporary line(s) from the first point to the mouse.
		/// </summary>
		/// <param name="g"></param>
		public override void AfterPaint(Graphics g)
		{
			base.AfterPaint(g);

			PointF[] pts = new PointF[_Points.Count + 1];
			for (int i = 0; i < _Points.Count; i++)
				pts[i] = (PointF)_Points[i].RootLayerCoordinates;
			pts[_Points.Count] = (PointF)_positionCurrentMouseInRootLayerCoordinates;

			if (pts.Length >= 3)
				g.DrawClosedCurve(Pens.Blue, pts, (float)_tension, FillMode.Alternate);
			else if (pts.Length >= 2)
				g.DrawCurve(Pens.Blue, pts, (float)_tension);
		}
コード例 #8
0
ファイル: Form1.cs プロジェクト: fiftin/Pengball
        private void DrawFixture(Fixture fixture, Color color, Graphics g)
        {
            var vertices = fixture.GetVertices();
            if (vertices.Length > 2)
            {
                g.DrawClosedCurve(new Pen(color), vertices, 0, System.Drawing.Drawing2D.FillMode.Winding);
            }

            for (var i = 0; i <vertices.Length; i++)
            {
                var vertex = vertices[i];
                g.FillEllipse(new SolidBrush(color), vertex.X - 2, vertex.Y - 2, 4, 4);
                g.DrawString(i.ToString(), pnlCanvas.Font, new SolidBrush(color), vertex.X - 4, vertex.Y - 15);
            }
        }
コード例 #9
0
ファイル: Draw.cs プロジェクト: NumberFour8/PhysBox
        private void RenderAllObjects(Graphics Destination)
        {
            foreach (SimObject o in MyWorld.Objects)
            {
                GraphicObject obj = o.Model as GraphicObject;
                GraphicsPath pth = obj.MakePath();
                if (menu_enableWireframe.Checked)
                {
                    Pen p = Pens.Black;
                    if (Selected != null && obj.Name == (Selected.Model as GraphicObject).Name)
                    {
                        p = Pens.Violet;
                        if (menu_showVertices.Checked) // Je-li třeba vykresli vertexy objektu
                        {
                            foreach (PointF pt in pth.PathPoints)
                                Destination.FillRectangle(Brushes.Navy, new RectangleF(pt.X - 2, pt.Y - 2, 4, 4));
                        }
                    }

                    // Nakresli obrys objektu, jeho těžiště a osu rotace
                    Destination.DrawPath(p, pth);
                    Destination.FillEllipse(Brushes.Black, new RectangleF((float)(obj.Position[0] - 2), (float)(obj.Position[1] - 2), 4, 4)); // Těžiště
                    Destination.FillEllipse(Brushes.Blue, new RectangleF((float)(o.RotationPoint[0] - 2),(float)(o.RotationPoint[1] - 2), 4, 4)); // Osa rotace

                    // Je-li třeba vykresli i ohraničující box tělesa
                    if (menu_showBounds.Checked && !obj.Convex)
                      Destination.DrawClosedCurve(Pens.Gray, obj.BoundingBox, 0, FillMode.Alternate);

                    if (menu_showVectors.Checked && !o.Static){
                        Vector v = o.LinearVelocity/10;
                        Destination.DrawLine(Pens.DarkOliveGreen, (PointF)o.COG, (PointF)(o.COG+v));

                        Vector textPos = new Vector(o.COG);
                        textPos[1] += 5*ScaleRatio;

                        Destination.DrawString(String.Format("{0:f2} m/s", MyWorld.Convert(o.LinearVelocity.Magnitude, ConversionType.PixelsToMeters)), new Font(FontFamily.GenericSansSerif, 6 * ScaleRatio), Brushes.DarkOliveGreen, (PointF)textPos);
                        textPos[1] += 7*ScaleRatio;
                        Destination.DrawString(String.Format("{0:f2} rad/s", o.AngularVelocity.Magnitude), new Font(FontFamily.GenericSansSerif, 6 * ScaleRatio), Brushes.DarkOrange, (PointF)textPos);
                    }
                }
                else Destination.FillPath(obj.Fill, obj.MakePath()); // Jinak nakresli objekt vyplněný texturou/barvou
            }
        }
コード例 #10
0
ファイル: SplineConnection.cs プロジェクト: Altaxo/Altaxo
		/// <summary>
		/// Template to make a line draw.
		/// </summary>
		/// <param name="g">Graphics context.</param>
		/// <param name="allLinePoints">The plot data. Don't use the Range property of the pdata, since it is overriden by the next argument.</param>
		/// <param name="range">The plot range to use.</param>
		/// <param name="layer">Graphics layer.</param>
		/// <param name="linePen">The pen to draw the line.</param>
		/// <param name="symbolGap">The size of the symbol gap. Argument is the original index of the data. The return value is the absolute symbol gap at this index.
		/// This function is null if no symbol gap is required.</param>
		/// <param name="skipFrequency">Skip frequency. Normally 1, thus all gaps are taken into account. If 2, only every 2nd gap is taken into account, and so on.</param>
		/// <param name="connectCircular">If true, there is a line connecting the start and the end of the range.</param>
		/// <param name="linePlotStyle">The line plot style.</param>
		public override void PaintOneRange(
			Graphics g,
			PointF[] allLinePoints,
			IPlotRange range,
			IPlotArea layer,
			PenX linePen,
			Func<int, double> symbolGap,
			int skipFrequency,
			bool connectCircular,
			LinePlotStyle linePlotStyle)
		{
			PointF[] subLinePoints;
			if (range.LowerBound == 0 && range.UpperBound == allLinePoints.Length)
			{
				// under optimal conditions we can use allLinePoints directly
				subLinePoints = allLinePoints;
			}
			else
			{
				// otherwise, make a new array
				subLinePoints = new PointF[range.Length];
				Array.Copy(allLinePoints, range.LowerBound, subLinePoints, 0, range.Length); // Extract
			}

			int lastIdx = range.Length - 1;
			var layerSize = layer.Size;

			if (connectCircular)
			{
				if (symbolGap != null)
				{
					// convert points to bezier segments
					var bezierSegments = GdiExtensionMethods.ClosedCardinalSplineToBezierSegments(subLinePoints, subLinePoints.Length);
					var subBezierSegments = new PointF[0];
					int subPointLengthM1, subBezierLength;
					for (int i = 0; i < (range.Length); i += skipFrequency)
					{
						subPointLengthM1 = Math.Min(skipFrequency, range.Length - i);
						int originalIndexAtStart = range.GetOriginalRowIndexFromPlotPointIndex(i + range.LowerBound);
						double gapAtStart = symbolGap(originalIndexAtStart);
						int originalIndexAtEnd = ((i + skipFrequency) < range.Length) ? range.GetOriginalRowIndexFromPlotPointIndex(i + range.LowerBound + skipFrequency) : range.OriginalFirstPoint;
						double gapAtEnd = symbolGap(originalIndexAtEnd);
						subBezierLength = 3 * subPointLengthM1 + 1;
						if (subBezierSegments.Length != subBezierLength)
							subBezierSegments = new PointF[subBezierLength];

						Array.Copy(bezierSegments, i * 3, subBezierSegments, 0, subBezierLength);
						var shortenedBezierSegments = GdiExtensionMethods.ShortenBezierCurve(subBezierSegments, gapAtStart / 2, gapAtEnd / 2);

						if (null != shortenedBezierSegments)
						{
							g.DrawBeziers(linePen, shortenedBezierSegments);
						}
					}
				}
				else
				{
					g.DrawClosedCurve(linePen, subLinePoints);
				}
			}
			else
			{
				if (symbolGap != null)
				{
					// convert points to bezier segments
					var bezierSegments = GdiExtensionMethods.OpenCardinalSplineToBezierSegments(subLinePoints, subLinePoints.Length);
					var subBezierSegments = new PointF[0];
					int subPointLengthM1, subBezierLength;
					for (int i = 0; i < (range.Length - 1); i += skipFrequency)
					{
						subPointLengthM1 = Math.Min(skipFrequency, range.Length - 1 - i);
						int originalIndex = range.GetOriginalRowIndexFromPlotPointIndex(i + range.LowerBound);
						double gapAtStart = symbolGap(originalIndex);
						double gapAtEnd = subPointLengthM1 == skipFrequency ? symbolGap(range.GetOriginalRowIndexFromPlotPointIndex(i + range.LowerBound + skipFrequency)) : 0;
						subBezierLength = 3 * subPointLengthM1 + 1;
						if (subBezierSegments.Length != subBezierLength)
							subBezierSegments = new PointF[subBezierLength];

						Array.Copy(bezierSegments, i * 3, subBezierSegments, 0, subBezierLength);
						var shortenedBezierSegments = GdiExtensionMethods.ShortenBezierCurve(subBezierSegments, gapAtStart / 2, gapAtEnd / 2);

						if (null != shortenedBezierSegments)
						{
							g.DrawBeziers(linePen, shortenedBezierSegments);
						}
					}
				}
				else
				{
					g.DrawCurve(linePen, subLinePoints);
				}
			}
		}
コード例 #11
0
ファイル: MyClass.cs プロジェクト: Mexahoid/CSF
        public void Draw(Graphics g)
        {
            Pen myPen1 = new Pen(Color.Red, 3);
            g.PageUnit = GraphicsUnit.Pixel;
            g.DrawEllipse(myPen1, 10, 10, 200, 100);

            g.PageUnit = GraphicsUnit.Display;
            //g.DrawEllipse(Pens.Black, 10, 10, 200, 100);

            g.PageUnit = GraphicsUnit.Point;
            //g.DrawEllipse(Pens.Black, 10, 10, 200, 100);

            g.PageUnit = GraphicsUnit.Millimeter;
            //g.DrawEllipse(Pens.Black, 10, 10, 20, 10);

            g.PageUnit = GraphicsUnit.Document;
            //g.DrawEllipse(Pens.Black, 10, 10, 200, 100);

            Pen myPen = new Pen(Color.Black, 0.05F);
            g.PageUnit = GraphicsUnit.Inch;
            //g.DrawEllipse(myPen, 1, 1, 2, 1);

            //Font Brush Pen

            int w = 1000;//размеры клиентской области
            int h = 1000;//размеры клиентской области

            int widthLines = 25;//Ширина клетки
            int heightLines = 25;//Высота клетки
            for (int i = 0; i < w; i += widthLines)
            {
                //Вертикальные линии
                g.DrawLine(new Pen(Brushes.BlueViolet), new Point(i + widthLines, 0), new Point(i + widthLines, h));
                //Горизонтальные линии
                g.DrawLine(new Pen(Brushes.BlueViolet), new Point(0, i + heightLines), new Point(w, i + heightLines));
            }

            g.DrawClosedCurve(Pens.Black, new Point[] {
                new Point (110,10),
                new Point (150,10),
                new Point (160,40),
                new Point (120,20),
                new Point (120,60),}, 1, FillMode.Winding);

            g.DrawArc(Pens.Black, new Rectangle(120, 120, 20, 20), 0, 90);
            g.DrawBezier(Pens.Black, new Point(110, 10),
                new Point(150, 10),
                new Point(160, 40),
                new Point(120, 20));
            g.DrawClosedCurve(Pens.Black, new Point[] {
                new Point (110,10),
                new Point (150,10),
                new Point (160,40),
                new Point (120,20),
                new Point (120,60),}, 5, FillMode.Winding); //.Alternate);

            g.DrawCurve(Pens.Black, new Point[] {
                new Point (110,10),
                new Point (150,10),
                new Point (160,40),
                new Point (120,20),
                new Point (120,60)});

            g.DrawEllipse(Pens.Black, new Rectangle(120, 120, 20, 20));

            Rectangle r = new Rectangle(0, 0, 200, 200);
            //g.DrawImage(theImage, r);
            //theImage.Dispose();

            int k = 0xFF;
            Color col = Color.FromArgb(12);
            int y = 0;

            Pen p = new Pen(Brushes.Black, 1); //Pens.Black;
            p.Color = Color.FromArgb(0xFF, 0x00, 0x00);
            Pen q = new Pen(Color.Black, 1);
            q.Color = Color.FromArgb(0xFF, 0x00, 0x00);

            p.Width = 2;
            //p.Color = Color.
            Rectangle rect = new Rectangle(10, 10, 400, 30);
            g.DrawRectangle(p, rect);

            Font myFont = new Font(FontFamily.GenericSansSerif, 12);
            g.DrawString("Выравнивание слева", myFont, Brushes.Black, rect);

            /*
            g.FillRectangle(Brushes.White, r);
            g.FillRectangle(Brushes.Red, new Rectangle(10, 10, 50, 50));
            Brush linearGradientBrush = new LinearGradientBrush(
                new Rectangle(10, 60, 50, 50), Color.Blue, Color.White, 45);
            g.FillRectangle(linearGradientBrush, new Rectangle(10, 60, 50, 50));
            // Вызов метода Dispose() вручную.
            linearGradientBrush.Dispose();
            g.FillEllipse(Brushes.Aquamarine, new Rectangle(60, 20, 50, 30));
            g.FillPie(Brushes.Chartreuse, new Rectangle(60, 60, 50, 50), 90, 210);
            g.FillPolygon(Brushes.BlueViolet, new Point[] {
                new Point (110,10),
                new Point (150,10),
                new Point (160,40),
                new Point (120,20),
                new Point (120,60),
            });
            */
        }
コード例 #12
0
 public override void Draw(Graphics g)
 {
     using(Pen p = new Pen(penColor,penWidth))
     {
         g.DrawClosedCurve(p,pointlist);
     }
 }