C# ile timer kullanımı

Spectrum Artz

Web | Graphics
Ultra Member
Katılım
31 Tem 2019
Konular
443
Mesajlar
524
Tepkime puanı
111
uygulamamızda Label1 deki yazıları timer1’a göre sırayla değiştiriyor .



C#:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Threading;
 
namespace WindowsApplication1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            
            InitializeComponent();
                    }
        
        string a = "csharp";
        string b = "örnekleri";
        string c = ".wordpress";
        string d = ".com";
      
        private void timer1_Tick(object sender, EventArgs e)
        {
 
            
                label1.Text = a.Substring(0);
            
            
        }
 
        private void button1_Click(object sender, EventArgs e)
        {
            Thread.Sleep(200);
            timer1.Start();
            timer1.Interval= 2000;
            Thread.Sleep(550);
            timer2.Start();
            timer2.Interval = 2000;
            Thread.Sleep(900);
            timer3.Start();
            timer3.Interval = 2000;
 
            Thread.Sleep(1200);
            timer4.Start();
            timer4.Interval = 2000;
          
        }
 
        private void timer2_Tick(object sender, EventArgs e)
        {
            
          
                label1.Text = b.Substring(0);
            
        }
 
        private void timer3_Tick(object sender, EventArgs e)
        {
          
                label1.Text =c.Substring(0);
            
        }
 
        private void timer4_Tick(object sender, EventArgs e)
        {
                label1.Text = d.Substring(0);
            
        }
    }
}
 
Üst