Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
public partial class DrawingView : AppKit.NSView
{
public DrawingView (CGRect r) : base (r)
{
}
public override void DrawRect (CGRect dirtyRect)
{
using (var g = Graphics.FromCurrentContext ()) {
g.Clear (Color.White);
CGRect ClientRectangle = dirtyRect;
g.PageUnit = GraphicsUnit.Inch;
g.TranslateTransform (((float)ClientRectangle.Width / g.DpiX) / 2, ((float)ClientRectangle.Height / g.DpiY) / 2);
Pen greenPen = new Pen (Color.Green, 1 / g.DpiX);
g.DrawLine (greenPen, 0, 0, 1, 1);
g.Dispose ();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.