[Gtk-sharp-list] Drawingarea shows nothing

Alexander Krivács Schrøder alexschrod at gmail.com
Sun Mar 24 11:08:38 UTC 2013


On 23.03.2013 15:09, monowiki wrote:
> I'd like to stroke on Drawingarea using Cairo.
> My code worked, but it shows nothing.
> Next code I created is to draw a line on the drawingarea.
>
> --------------code---------------------
>
> using System;
> using Gtk;
>
> public partial class MainWindow: Gtk.Window
> {	
> 	public MainWindow (): base (Gtk.WindowType.Toplevel)
> 	{
> 		Build ();
> 		//this.GdkWindow.KeepBelow=true;
> 	}
> 	
> 	protected void OnDeleteEvent (object sender, DeleteEventArgs a)
> 	{
> 		Application.Quit ();
> 		a.RetVal = true;
> 	}
> 	
> 	
> 	protected void OnExposeEvent (object o, Gtk.ExposeEventArgs args)
> 	{
> 		//da:DrawingArea
> 		Cairo.Context cxt = Gdk.CairoHelper.Create(da.GdkWindow);
> 		cxt.LineWidth=30.0;
> 		cxt.SetSourceRGB(1.0,0.5,0.0);
> 		cxt.LineCap=Cairo.LineCap.Butt;
> 		cxt.MoveTo (40,50);
> 		cxt.LineTo(250,50);
> 		cxt.Stroke();
> 		this.GdkWindow.Clear ();
> 	}
> }
> -----------------code------------------
> <http://mono.1490590.n4.nabble.com/file/n4659137/da_shows_nothing.png> 
> A red line should be drawn on this window...
>
> Any ideas?
>
>
>
> --
> View this message in context: http://mono.1490590.n4.nabble.com/Drawingarea-shows-nothing-tp4659137.html
> Sent from the Mono - Gtk# mailing list archive at Nabble.com.
> _______________________________________________
> Gtk-sharp-list maillist  -  Gtk-sharp-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/gtk-sharp-list
You're clearing the window after drawing with GdkWindow.Clear(). Try
removing that?

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 261 bytes
Desc: OpenPGP digital signature
URL: <http://lists.ximian.com/pipermail/gtk-sharp-list/attachments/20130324/df5b7008/attachment.pgp>


More information about the Gtk-sharp-list mailing list