Created
February 6, 2011 03:39
-
-
Save Clancey/813102 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Drawing; | |
using MonoMac.Foundation; | |
using MonoMac.AppKit; | |
using MonoMac.ObjCRuntime; | |
namespace BundlerCrash | |
{ | |
public partial class AppDelegate : NSApplicationDelegate | |
{ | |
MainWindowController mainWindowController; | |
public AppDelegate () | |
{ | |
} | |
MyView view; | |
public override void FinishedLaunching (NSObject notification) | |
{ | |
mainWindowController = new MainWindowController (); | |
view = new MyView(mainWindowController.Window.Frame); | |
mainWindowController.Window.ContentView.AddSubview(view); | |
mainWindowController.Window.MakeKeyAndOrderFront (this); | |
} | |
} | |
public class MyView : NSView | |
{ | |
public MyView(RectangleF rect) : base (rect) | |
{ | |
} | |
public override void DrawRect (RectangleF dirtyRect) | |
{ | |
using(var G = Graphics.FromHwnd(this.Handle)) | |
{ | |
Pen pen = new Pen(Color.Green, 2.0f); | |
Brush brush = new SolidBrush(Color.Blue); | |
G.DrawRectangle(pen,Rectangle.Round(dirtyRect)); | |
G.FillRectangle(brush,Rectangle.Round(dirtyRect)); | |
} | |
base.DrawRect (dirtyRect); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment