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  -  [email protected]
> http://lists.ximian.com/mailman/listinfo/gtk-sharp-list
You're clearing the window after drawing with GdkWindow.Clear(). Try
removing that?

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
Gtk-sharp-list maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/gtk-sharp-list

Reply via email to