// Collection of code snippets by Arne Vajhøj // (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) using System; using System.Drawing; using System.Windows.Forms; namespace E { public class MainForm : Form { private Label label1; private Button button1; public MainForm() { InitializeComponent(); } [STAThread] public static void Main(string[] args) { Application.Run(new MainForm()); } private void InitializeComponent() { button1 = new Button(); label1 = new Label(); SuspendLayout(); button1.Location = new Point(25, 75); button1.Size = new Size(100, 25); button1.Text = "Synlig"; button1.Click += new EventHandler(Button1Click); label1.Location = new Point(25, 25); label1.Size = new Size(100, 25); label1.Text = "Dette er en prøve"; label1.Visible = false; ClientSize = new Size(150, 150); Controls.Add(button1); Controls.Add(label1); Text = "MainForm"; ResumeLayout(false); } private System.Threading.Timer t; void Button1Click(object sender, System.EventArgs e) { label1.Visible = true; t = new System.Threading.Timer(new System.Threading.TimerCallback(InvisibleAgain), null, 5000, System.Threading.Timeout.Infinite); } public void InvisibleAgain(Object o) { t.Dispose(); label1.Visible = false; } } }