일반
프로그레스바 연습하기
알 수 없는 사용자
2022. 1. 17. 11:55
SMALL
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace datagridex1
{
public partial class Form1 : Form
{
private Timer timer;
private int timerCount = 0;
public Form1()
{
InitializeComponent();
// 테스트용으로 타이머 이용
timer = new Timer();
timer.Interval = 1000;
timer.Tick += new EventHandler(timer_Tick);
}
private void Form1_Load(object sender, EventArgs e)
{
// 디폴트값 사용 (Maximum=100, Minimum=0, Step=10)
progressBar1.Style = ProgressBarStyle.Blocks;
// 테스트를 위해 타이머 시작
timer.Start();
}
private void timer_Tick(object sender, EventArgs e)
{
// 한 스텝 이동
progressBar1.PerformStep();
// 타이머 중지 조건
if (++timerCount == 10)
{
timer.Stop();
}
}
}
}
LIST