[Gtk-sharp-list] Drawingarea shows nothing

monowiki www.carrotsoft at gmail.com
Sat Mar 23 14:09:18 UTC 2013


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.


More information about the Gtk-sharp-list mailing list