[Mono-docs-list] help - sample events
latency
latency at gmx.de
Sun Aug 6 14:30:24 EDT 2006
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 - Mono-docs-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-docs-list
More information about the Mono-docs-list
mailing list