DrawingContext.DrawEllipse(...) in .Net Micro Framework

Answered DrawingContext.DrawEllipse(...) in .Net Micro Framework

  • Saturday, August 15, 2009 11:11 AM
     
     
    I'm using the .Net Micro Framework 3.0 and i'm having trouble drawing a color-filled ellipse. It seems the DrawEllipse ( Brush brush , Pen pen , int x , int y , int xRadius , int yRadius ) method in Microsoft.SPOT.Presentation.Media.DrawingContext is bugged or i'm doing something wrong. It only draws the outline of the ellipse and doesn't fill it.

    I did the following test inside a class that extends UIElement:

            public override void OnRender(DrawingContext dc) {
                dc.DrawRectangle(new SolidColorBrush(Colors.Red), new Pen(Colors.Green), 10, 10, 10, 10);
                dc.DrawEllipse(new SolidColorBrush(Colors.Red), new Pen(Colors.Green), 50, 50, 10, 10);
                dc.Bitmap.DrawEllipse(Colors.Green, 1, 100, 100, 10, 10, Colors.Red, 90, 90, Colors.Red, 110, 110, 255);
                dc.Bitmap.DrawRectangle(Colors.Green, 1, 150, 150, 10, 10,0,0, Colors.Red, 140, 140, Colors.Red, 160, 160, 255);
            }


    The DrawRectangle works perfectly: it draws a red rectangle with a green outline. However DrawEllipse draws only a green outline of the ellipse. I tried to work around it via the Bitmap class. However it's the same problem here: DrawRectangle works fine, DrawEllipse draws only the outline. How can i draw a color-filled ellipse?

    Another small question: the method DrawLine ( Pen pen , int x0 , int y0 , int x1 , int y1 ) in DrawingContext seems to ignore the thickness of the Pen given to it. It always draws a 1-pixel wide line. Is this normal? This isn't really a big problem, i can draw lines next to each other to work around this, but it's unhandy.
    • Edited by Neverwinterx Saturday, August 15, 2009 11:13 AM
    •  

All Replies

  • Saturday, August 15, 2009 6:22 PM
     
     Answered
    This is perfectly normal for version 3.0.  It only supports 1-pixel pens, and only fills rectangles.
     
    • Marked As Answer by Neverwinterx Saturday, August 15, 2009 9:14 PM
    •