Click here to Skip to main content
14,210,773 members
Rate this:
Please Sign up or sign in to vote.
See more:
I want to fill region between two lines in in a c# graphics using c#.


i'm using drawlines method to draw the two curves

points.Add(new PointF(x + left, (float)y + trackHeight));

...
if (points.Count > 1)
    {
      using (Pen pen = HandlerGraphs.GetPen(log.LineStyle, log.Brush, 2))
         {
           gr.DrawLines(pen, points.ToArray());
          }
 }


for fill region, i tried

gr.FillClosedCurve(new SolidBrush(log.leftColorShading), leftPoints.ToArray(), FillMode.Alternate);


[^]

but that take more than two minuts (my curve is composed from 13255 point)

any idea?
Posted

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

   
Comments
Member 8727660 14-Jun-15 17:11pm
   
how can i use fill region with a list of points?
Sergey Alexandrovich Kryukov 14-Jun-15 22:03pm
   
Why do you think I gave you the links? To let you read the articles and see further documentation. Did you even try it? Of course, you do it using the second Region constructor using System.Drawing.Drawing2D.GraphicsPath parameter.
Please see: https://msdn.microsoft.com/en-us/library/system.drawing.drawing2d.graphicspath%28v=vs.110%29.aspx,

Please see System.Drawing.Drawing2D.GraphicsPath constructors and all its Add methods. See also
https://msdn.microsoft.com/en-us/library/system.drawing.drawing2d.graphicspath.addpath%28v=vs.110%29.aspx.

Will you accept the answer formally now?

—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



Advertise | Privacy | Cookies | Terms of Service
Web02 | 2.8.190618.1 | Last Updated 14 Jun 2015
Copyright © CodeProject, 1999-2019
All Rights Reserved.
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100