0
Reply

GraphicsPath curved line problem

jarah

jarah

Jun 16 2008 2:32 PM
5.5k
I have a control with green background, and I want it to have a thin line shape.
Function DrawLine draws 2px black line, and I want my region clip to that line.
Evetything looks good, but i dont know why the AddCurve function draw CLOSED curve...

can anybody help me with this ? i need to have 2px width cuverd-line region.

I also tried to add another AddCurve function to the same path, but near begin end end point (in straight line) the region becomes thicker and in the middle it is ok - empty..

protected override void OnPaint( PaintEventArgs pe )
        {
            Graphics g = pe.Graphics;
            DrawLine(g);
            Point[] points = {_startXY,  c, _endXY};

            GraphicsPath path = new GraphicsPath();
            path.AddCurve(points);            
            this.Region = new Region(path);
              }