using System;
using System.Threading;
using System.Drawing;
using System.ComponentModel;
using XApp;
using XApp.UI.Controls;
using XApp.UI;
namespace XApp.Samples
{
/// <summary>
/// Summary description for App1.
/// </summary>
public class App1 : XAppInstance
{
protected Form mainForm;
protected Label label1;
protected TextBox textBox1;
protected Button button1;
public App1(XAppApplication application) : base(application)
{
}
protected override void InitInstanceWork()
{
mainForm=CreateForm("mainForm2");
mainForm.WindowRect=new RectangleF(50,60,300,100);
mainForm.Show();
mainForm=CreateForm("mainForm");
mainForm.WindowRect=new RectangleF(10,10,300,100);
label1=CreateLabel("label1");
label1.WindowRect=new RectangleF(5,9,50,15);
label1.Text="Pippo";
textBox1=CreateTextBox("text1");
textBox1.WindowRect=new Rectangle(40,5,100,70);
textBox1.Text="Testo";
textBox1.Multiline=true;
textBox1.WordWrap=false;
textBox1.ScrollBars=System.Windows.Forms.ScrollBars.Both;
button1=CreateButton("button1");
button1.WindowRect=new Rectangle(150,5,50,50);
button1.Text="Chiudi";
button1.Click+=new EventHandler(button1_Click);
mainForm.Text="Titolo finestra molto lungo";
mainForm.Closed+=new EventHandler(OnFormClosed);
mainForm.Controls.Add(label1);
mainForm.Controls.Add(textBox1);
mainForm.Controls.Add(button1);
mainForm.Show();
}
private void OnFormClosed(object sender, EventArgs e)
{
Terminate();
}
private void button1_Click(object sender, EventArgs e)
{
switch (MessageBox.Show(mainForm,"Uscire dall'applicazione?","Eccolo!",System.Windows.Forms.MessageBoxButtons.OKCancel))
{
case System.Windows.Forms.DialogResult.OK:
Terminate();
break;
case System.Windows.Forms.DialogResult.Cancel:
break;
}
}
}
}