Bug(s) in GraphicsEx.DrawLine?

Last post 10-27-2005 9:55 by Anonymous. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 10-27-2005 7:50

    Bug(s) in GraphicsEx.DrawLine?

    I have found 2 issues with GraphicsEx.DrawLine

    - It uses MoveToEx. This is not implemented in PocketPC 2002 but can be replaced by PolyLine.
    - At the end it calls DeleteObject which effectively deletes the pen contained in the PenEx object, so if you use the object again, you'll get a black line.

    Here is my replacement implementation:
    public void DrawLine(PenEx pen, int xStart, int yStart, int xEnd, int yEnd)
    {
    //hme: modified to get rid of movetoex
    IntPtr hOldPen = IntPtr.Zero;
    hOldPen = GDIPlus.SelectObject(hDC, pen.hPen);
    int[] Coords = {xStart,yStart,xEnd,yEnd};
    GDIPlus.Polyline(hDC, Coords,2);
    //Clean up
    GDIPlus.SelectObject(hDC, hOldPen);
    }

    Cheers

    Hans
  • 10-27-2005 9:55 In reply to

    Re: Bug(s) in GraphicsEx.DrawLine?

    The same applies for DrawEllipse too.
Page 1 of 1 (2 items)