/// <summary> /// Assign the time to the label. /// </summary> /// <param name="dato">Time in string formato to assign.</param> private void AsignarHora(string dato) { if (this.lblHora.InvokeRequired) { DelegadoHora dh = new DelegadoHora(AsignarHora); object[] objs = new object[] { dato }; this.Invoke(dh, objs); } else { this.lblHora.Text = dato; } }
public void AgregarHora() { if (this.lblHora.InvokeRequired) { DelegadoHora d = new DelegadoHora(AgregarHora); this.Invoke(d); } else { int c1 = r1.Next(0, 255); int c2 = r1.Next(0, 255); int c3 = r1.Next(0, 255); int x = r1.Next(20, 340); int y = r1.Next(20, 300); lblHora.Text = DateTime.Now.ToString(); lblHora.ForeColor = Color.FromArgb(c1, c2, c3); lblHora.Location = new Point(x, y); } }