I am trying to draw some circles on a view in MonoMac, but I don't have a single idea where to start from. Under .NET on Windows I'd do something like
Canvas canv = new Canvas();
Ellipse ell = new Ellipse();
Canvas.SetLeft(ell, 5);
Canvas.SetTop(ell, 5);
canv.Children.Add(ell);
Thanks.
MonoMac works a little differently than WPF. You have to do your drawing in the DrawRect() function of a derived class, like so:
public class MyDrawing : NSView
{
public override void DrawRect (RectangleF dirtyRect)
{
var context = NSGraphicsContext.CurrentContext.GraphicsPort;
context.SetStrokeColor (new CGColor(1.0, 0, 0)); // red
context.SetLineWidth (1.0F);
context.StrokeEllipseInRect (new RectangleF(5, 5, 10, 10));
}
}