Skip to content

Tutorial 1 Hello Eto.Forms

cwensley edited this page Apr 9, 2012 · 9 revisions

This tutorial will teach you how to create a simple "Hello World" application using Eto.Forms

  1. Follow Preparing your solution to create your solution

  2. Create a new class for your main form:

     class MyForm : Form
     {
     	public MyForm()
     	{
     		// sets the client (inner) size of the window for your content
     		this.ClientSize = new Size(600, 400);
     		
     		// create a label
     		var label = new Label { Text = "Hello Eto World" };
     		
     		// add the label to the window (using an extension method of DockLayout)
     		this.AddDockedControl (label);
     	}
     }
    
  3. In your main() function, create an Application object and handle the Initialized event:

     var app = new Application ();
     
     app.Initialized += delegate {
     	// only create new controls/forms/etc during or after this event
     	app.MainForm = new MyForm ();
     	app.MainForm.Show ();
     };
     
     app.Run (args);
    
  4. In order to run your application, follow Running your application

Next: Tutorial 2 Menus & Toolbars