[Gtk-sharp-list] How to use System.Drawing.Graphics in Mono ?
stifu at free.fr
Tue Nov 16 10:38:56 EST 2010
Drawing in the Click event sounds wrong.
You should probably do something like: flip a flag on Click, and invalidate
the control. Then in the Draw event handler method (whatever it's called in
GTK#), check the flag and draw appropriately (using the Graphics object
passed as parameter).
> I want to draw some lines in the Gtk.window. So,I put a DrawingArea and
> a button in the window. In the Click event of the button:
> System.Drawing.Graphics g =
> Gtk.DotNet.Graphics.FromDrawable(DA.GdkWindow, true));
> //DA is the DrawingArea in the window.
> g.DrawLine(new Pen(System.Drawing.Color.Red,1),5,5,100,5);
> catch(Exception ex)
> string str=ex.Message;
> when it runs at : g.DrawLine(...), an exception is raised
> the excetpion message is General Error in GDI+.
> I don't know how to fix this problem..
> Windows 7 + MonoDevelop + C#
View this message in context: http://mono.1490590.n4.nabble.com/How-to-use-System-Drawing-Graphics-in-Mono-tp3045000p3045045.html
Sent from the Mono - Gtk# mailing list archive at Nabble.com.
More information about the Gtk-sharp-list