All pastes #392802 Raw Edit

Untitled

public text v1 · immutable
·published 2007-03-13 02:19 UTC
rendered paste body
using System;
using Gtk;
using System.Drawing;


public partial class MainWindow: Gtk.Window
{	
	public MainWindow (): base (Gtk.WindowType.Toplevel)
	{
		Build ();
		DrawingArea da = new DrawingArea();
		da.ExposeEvent += OnExposed;
		this.scrolledwindow1.AddWithViewport(da);
		this.ShowAll();
	}
	
	protected void OnDeleteEvent (object sender, DeleteEventArgs a)
	{
		Application.Quit ();
		a.RetVal = true;
	}
	
	protected void OnExposed(object sender, ExposeEventArgs args)
	{
		int w,h;
		DrawingArea da = (DrawingArea)sender;
		using(Graphics g = Gtk.DotNet.Graphics.FromDrawable(da.GdkWindow))
		{
               Font f = new Font("Arial", 10);
               Brush b = new SolidBrush(Color.Black);
               for(int i = 0; i < 1000; i ++)
               {
					g.DrawString(i.ToString().PadLeft(8, '0'), f, b, 5, 0 + (10 * i));
               }
               da.GetSizeRequest(out w, out h);
               Pen p = new Pen(b);
               g.DrawLine(p, 80, 0, 80, h); 
		}
	}
}