Saturday, April 30, 2005

Starting with MWF

You will need libgdiplus installled on your system. (if you are running Ubuntu Breezy, you can use my personal ubuntu repository.

You also need Windows.Forms, if you need it just download it from here.

Yoy will need to install it with gacutil:
sudo gacutil -i System.Windows.Forms.dll

Now you can execute WindowsForm Apps ;)

Lets code..
Open monodevelop and create a new empty project. On the *Solution* window -> references -> Add reference and select System.Windows.Forms.



Create a new empty file and rename it to Main.cs and add the next code:
// created on 30/04/2005 at 17:38
using System.Windows.Forms;

class HelloWindowsForms
{

        public static void Main()
        {
                MessageBox.Show ("Hello World!");
        }

}


Well.. after this tipical 'hello world', we will try something more interesting...
// created on 30/04/2005 at 17:38
using System;
using System.Windows.Forms;


class MyForm : System.Windows.Forms.Form
{
 private RadioButton MyRadioButton;
 private System.ComponentModel.Container components = null;

 public MyForm()
 {
  InitializeComponent();
 }

 public static void Main()
 {
  Application.Run(new MyForm());
 }

 private void InitializeComponent()
 {
     this.MyRadioButton = new RadioButton();    
     this.MyRadioButton.Text = "My RadioButton";     
  this.Controls.AddRange(new System.Windows.Forms.Control[]{this.MyRadioButton}); 
 }

}

No comments: