Re: help - sample events

latency <[email protected]>
Newsgroups gmane.comp.gnome.mono.documentation
Message-ID <[email protected]>
Hi, since I don't know which GUI you wanted to use I provided a simple App 
using MWF. If you want to use GTK# or any other GUI the steps to display the 
button or form may be different however consuming events will still be the 
same.

using System;
using System.Windows.Forms;

public class FormMain : Form
{
	private Button but = null;

	public static void Main()
	{
		// Starting the Main Application Loop.
		Application.Run(new FormMain());
	}
	
	public FormMain()
	{
		// Creating the button and docking it to the bottom of the Form
		this.but = new Button();
		this.but.Text = "Close";
		this.but.Dock = DockStyle.Bottom;
		// Attaching the but_Click function to the Click event of the Button.
		this.but.Click += new EventHandler(this.but_Click);
		
		// Adding the button to the form.
		this.Controls.Add(this.but);
	}
	
	// This function is being called when the button is clicked.
	private void but_Click(object sender, System.EventArgs e)
	{
		// This closes the main window, which automatically terminates the
		// application.
		this.Close();
	}		
}

On Sunday 06 August 2006 17:12, Mariusz Mart wrote:
> Hi!
>
> Could anyone send me sample app with one window, one button and when i
> press this button app will close?!
>
> Thanks a lot!
>
> I'can find how to do this correctly :(
> _______________________________________________
> Mono-docs-list maillist  -  [email protected]
> http://lists.ximian.com/mailman/listinfo/mono-docs-list
_______________________________________________
Mono-docs-list maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-docs-list
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.