Ma infatti non è un problema, il fatto è che ero perplesso visto che ero rimasto all'utilizzo di WINE per il supporto delle windows form, cosa che pare che non ci sia più bisogno, dato che
http://www.mono-project.com/WinForms parla di un supporto completato.
Per kiroken, ecco il codice:
Codice: Seleziona tutto
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void cmdVisualizza_Click(object sender, EventArgs e)
{
MessageBox.Show("Hai scritto: " + this.textBox1.Text, "Titolo...", MessageBoxButtons.OK);
}
private void button1_Click(object sender, EventArgs e)
{
Random rand = new Random();
int nr = rand.Next(10);
for (int k = 1; k < nr; k++)
this.lstElenco.Items.Add(string.Format("{0} - {1}", k.ToString(), this.textBox1.Text));
}
}
}
namespace WindowsFormsApplication1
{
partial class Form1
{
/// <summary>
/// Variabile di progettazione necessaria.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Liberare le risorse in uso.
/// </summary>
/// <param name="disposing">ha valore true se le risorse gestite devono essere eliminate, false in caso contrario.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Codice generato da Progettazione Windows Form
/// <summary>
/// Metodo necessario per il supporto della finestra di progettazione. Non modificare
/// il contenuto del metodo con l'editor di codice.
/// </summary>
private void InitializeComponent()
{
this.lblEtichetta = new System.Windows.Forms.Label();
this.textBox1 = new System.Windows.Forms.TextBox();
this.cmdVisualizza = new System.Windows.Forms.Button();
this.lstElenco = new System.Windows.Forms.ListBox();
this.button1 = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// lblEtichetta
//
this.lblEtichetta.AutoSize = true;
this.lblEtichetta.Font = new System.Drawing.Font("Arial", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblEtichetta.Location = new System.Drawing.Point(12, 9);
this.lblEtichetta.Name = "lblEtichetta";
this.lblEtichetta.Size = new System.Drawing.Size(106, 16);
this.lblEtichetta.TabIndex = 0;
this.lblEtichetta.Text = "Scrivi del testo:";
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(124, 8);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(275, 20);
this.textBox1.TabIndex = 1;
//
// cmdVisualizza
//
this.cmdVisualizza.Location = new System.Drawing.Point(405, 6);
this.cmdVisualizza.Name = "cmdVisualizza";
this.cmdVisualizza.Size = new System.Drawing.Size(75, 23);
this.cmdVisualizza.TabIndex = 2;
this.cmdVisualizza.Text = "Visualizza";
this.cmdVisualizza.UseVisualStyleBackColor = true;
this.cmdVisualizza.Click += new System.EventHandler(this.cmdVisualizza_Click);
//
// lstElenco
//
this.lstElenco.FormattingEnabled = true;
this.lstElenco.Location = new System.Drawing.Point(12, 89);
this.lstElenco.Name = "lstElenco";
this.lstElenco.Size = new System.Drawing.Size(468, 121);
this.lstElenco.TabIndex = 3;
//
// button1
//
this.button1.Location = new System.Drawing.Point(405, 60);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(75, 23);
this.button1.TabIndex = 4;
this.button1.Text = "Elenca";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(487, 222);
this.Controls.Add(this.button1);
this.Controls.Add(this.lstElenco);
this.Controls.Add(this.cmdVisualizza);
this.Controls.Add(this.textBox1);
this.Controls.Add(this.lblEtichetta);
this.Name = "Form1";
this.Text = "Form1";
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Label lblEtichetta;
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.Button cmdVisualizza;
private System.Windows.Forms.ListBox lstElenco;
private System.Windows.Forms.Button button1;
}
}