Click here to Skip to main content
15,886,664 members
Please Sign up or sign in to vote.
2.00/5 (1 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

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

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


for fill region, i tried

C#
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

 
Share this answer
 
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)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900