반응형
안녕하세요 hayee 입니다.
회사 업무가 바빠서 이제야 글을 올리네요. 오늘의 포스팅은 프로그래스바에 대해 써볼까 합니다.
◈ ProgressBar 컨트롤.
→ 어떤 작업의 진행 상태를 표시하기 위해 사용되는 컨트롤.
(Style Block: 블럭 모양 형태, continuous 연속적인 형태, Marquee: 연속적으로 계속 실행되는 형태)
Program.cs 에서 Application.EnableVisualStyles( ) 함수를 사용할 경우 Block 및 continuous 스타일은 둘 다 연속적인 형태로 표현되지만, 해당 함수를 사용하지 않을 경우 아래 결과창과 같이 스타일이 구분되어 지고,Marguee 스타일은 지원하지 않습니다. 또한 색상을 변경할 수 있게 됩니다. (ForeColor 로 색상 변경하기)
◈ 예제 소스
namespace CTestControl
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
progressBar3.MarqueeAnimationSpeed = 10;
}
private void Form1_Load(object sender, EventArgs e)
{
// Progressbar style: continuous 일 경우 값들을 설정해 주어야 한다.
progressBar2.Minimum = 0;
progressBar2.Maximum = 200;
progressBar2.Step = 10;
progressBar2.Value = 0;
}
private void button1_Click(object sender, EventArgs e)
{
// 프로그래스 바 진행상태를 변경한다. (설정한 스텝만큼)
progressBar1.PerformStep();
progressBar2.PerformStep();
}
private void button2_Click(object sender, EventArgs e)
{
// 값을 0으로 하여 프로그래스 바 진행상태를 초기화 해준다.
progressBar1.Value = 0;
progressBar2.Value = 0;
}
}
}
◈ 실행 결과
# 틀린 부분이 있다면 댓글 부탁드립니다. #
# 댓글 달아주시면 늦게라도 블로그 방문하도록 할게요! 감사합니다. #
728x90
반응형
'hayee Study > 코딩_c#' 카테고리의 다른 글
[C#] AutoResetEvent, ManualResetEvent 에 대하여 (0) | 2023.10.08 |
---|---|
[C#] show, showDialog (모달리스와 모달 차이점) (2) | 2023.10.03 |
[C#] 작업스케줄러 (2) | 2023.10.02 |
[C#] ConcurrentQueue, Queue (1) | 2023.09.21 |
[C#] ? 연산자 (조건부 연산자) (0) | 2023.09.18 |