Questo sito utilizza cookies solo per scopi di autenticazione sul sito e nient'altro. Nessuna informazione personale viene tracciata. Leggi l'informativa sui cookies.
Username: Password: oppure
Colori 2 - Form1.cs

Form1.cs

Caricato da:
Scarica il programma completo

  1. using System;
  2. using System.Drawing;
  3. using System.Collections;
  4. using System.ComponentModel;
  5. using System.Windows.Forms;
  6. using System.Data;
  7.  
  8. namespace CoLoRi2
  9. {
  10.         /// <summary>
  11.         /// Descrizione di riepilogo per Form1.
  12.         /// </summary>
  13.         public class Form1 : System.Windows.Forms.Form
  14.         {
  15.                 private System.Windows.Forms.Timer timer1;
  16.                 private System.Windows.Forms.Label a1;
  17.                 private System.Windows.Forms.Label b1;
  18.                 private System.ComponentModel.IContainer components;
  19.  
  20.                 public Form1()
  21.                 {
  22.                         //
  23.                         // Necessario per il supporto di Progettazione Windows Form
  24.                         //
  25.                         InitializeComponent();
  26.  
  27.                         //
  28.                         // TODO: aggiungere il codice del costruttore dopo la chiamata a InitializeComponent
  29.                         //
  30.                 }
  31.  
  32.                 /// <summary>
  33.                 /// Pulire le risorse in uso.
  34.                 /// </summary>
  35.                 protected override void Dispose( bool disposing )
  36.                 {
  37.                         if( disposing )
  38.                         {
  39.                                 if (components != null)
  40.                                 {
  41.                                         components.Dispose();
  42.                                 }
  43.                         }
  44.                         base.Dispose( disposing );
  45.                 }
  46.  
  47.                 #region Codice generato da Progettazione Windows Form
  48.                 /// <summary>
  49.                 /// Metodo necessario per il supporto della finestra di progettazione. Non modificare
  50.                 /// il contenuto del metodo con l'editor di codice.
  51.                 /// </summary>
  52.                 private void InitializeComponent()
  53.                 {
  54.                         this.components = new System.ComponentModel.Container();
  55.                         this.a1 = new System.Windows.Forms.Label();
  56.                         this.b1 = new System.Windows.Forms.Label();
  57.                         this.timer1 = new System.Windows.Forms.Timer(this.components);
  58.                         this.SuspendLayout();
  59.                         //
  60.                         // a1
  61.                         //
  62.                         this.a1.Font = new System.Drawing.Font("Comic Sans MS", 36F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
  63.                         this.a1.Location = new System.Drawing.Point(8, 0);
  64.                         this.a1.Name = "a1";
  65.                         this.a1.Size = new System.Drawing.Size(272, 72);
  66.                         this.a1.TabIndex = 0;
  67.                         this.a1.Text = "PieRoToFy";
  68.                         this.a1.Visible = false;
  69.                         //
  70.                         // b1
  71.                         //
  72.                         this.b1.Font = new System.Drawing.Font("Comic Sans MS", 36F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
  73.                         this.b1.Location = new System.Drawing.Point(88, 64);
  74.                         this.b1.Name = "b1";
  75.                         this.b1.Size = new System.Drawing.Size(176, 56);
  76.                         this.b1.TabIndex = 1;
  77.                         this.b1.Text = ".It";
  78.                         this.b1.Visible = false;
  79.                         //
  80.                         // timer1
  81.                         //
  82.                         this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
  83.                         //
  84.                         // Form1
  85.                         //
  86.                         this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
  87.                         this.ClientSize = new System.Drawing.Size(288, 126);
  88.                         this.Controls.Add(this.b1);
  89.                         this.Controls.Add(this.a1);
  90.                         this.MaximizeBox = false;
  91.                         this.Name = "Form1";
  92.                         this.Text = "CoLoRi2 By SaTaNa";
  93.                         this.Load += new System.EventHandler(this.Form1_Load);
  94.                         this.ResumeLayout(false);
  95.  
  96.                 }
  97.                 #endregion
  98.  
  99.                 /// <summary>
  100.                 /// Il punto di ingresso principale dell'applicazione.
  101.                 /// </summary>
  102.                 [STAThread]
  103.                 static void Main()
  104.                 {
  105.                         Application.Run(new Form1());
  106.                 }
  107.  
  108.                 private void Form1_Load(object sender, System.EventArgs e)
  109.                 {
  110.                 timer1.Start();
  111.                 }
  112.  
  113.                 private void timer1_Tick(object sender, System.EventArgs e)
  114.                 {
  115.                        
  116.                                 a1.Visible=true;
  117.                             b1.Visible=true;
  118.                             Random rnd=new Random();
  119.                                 int a,b,c;
  120.                                 a=rnd.Next(255);
  121.                                 b=rnd.Next(255);
  122.                                 c=rnd.Next(255);
  123.                                 a1.ForeColor=Color.FromArgb(a,b,c);
  124.                                 b1.ForeColor=a1.ForeColor;
  125.                        
  126.                 }
  127.         }
  128. }