ProgressBar.Value 속성

정의

진행률 표시줄의 현재 위치를 가져오거나 설정합니다.

public:
 property int Value { int get(); void set(int value); };
[System.ComponentModel.Bindable(true)]
public int Value { get; set; }
[<System.ComponentModel.Bindable(true)>]
member this.Value : int with get, set
Public Property Value As Integer

속성 값

진행률 표시줄의 범위 내에 있는 위치입니다. 기본값은 0입니다.

특성

예외

지정된 값이 Maximum 속성 값보다 큰 경우

또는

지정된 값이 Minimum 속성 값보다 작은 경우

예제

다음 코드 예제를 사용 Increment 하는 방법을 보여 줍니다 합니다 메서드 및 Value 의 경우 값을 ProgressBarTick 증가 하는 속성입니다 Timer. 이 예제에서는 의 텍스트 표현ProgressBarStatusBarPanel 제공하기 위해 의 속성을 표시 Value 합니다. 이 예제에서는 ProgressBar 라는 컨트롤과 StatusBar 라는 progressBar1를 포함하는 컨트롤이 StatusBarPanelstatusBarPanel1있어야 합니다. Timer라는 를 time폼에 멤버로 추가해야 합니다.

private:
   Timer^ time;

   // Call this method from the constructor of the form.
   void InitializeMyTimer()
   {
      // Set the interval for the timer.
      time->Interval = 250;

      // Connect the Tick event of the timer to its event handler.
      time->Tick += gcnew EventHandler( this, &Form1::IncreaseProgressBar );

      // Start the timer.
      time->Start();
   }

   void IncreaseProgressBar( Object^ /*sender*/, EventArgs^ /*e*/ )
   {
      // Increment the value of the ProgressBar a value of one each time.
      progressBar1->Increment( 1 );

      // Display the textual value of the ProgressBar in the StatusBar control's first panel.
      statusBarPanel1->Text = String::Concat( progressBar1->Value, "% Completed" );

      // Determine if we have completed by comparing the value of the Value property to the Maximum value.
      if ( progressBar1->Value == progressBar1->Maximum )

      // Stop the timer.
      time->Stop();
   }
private Timer time = new Timer();

// Call this method from the constructor of the form.
private void InitializeMyTimer()
{
   // Set the interval for the timer.
   time.Interval = 250;
   // Connect the Tick event of the timer to its event handler.
   time.Tick += new EventHandler(IncreaseProgressBar);
   // Start the timer.
   time.Start();
}

private void IncreaseProgressBar(object sender, EventArgs e)
{
   // Increment the value of the ProgressBar a value of one each time.
   progressBar1.Increment(1);
   // Display the textual value of the ProgressBar in the StatusBar control's first panel.
   statusBarPanel1.Text = progressBar1.Value.ToString() + "% Completed";
   // Determine if we have completed by comparing the value of the Value property to the Maximum value.
   if (progressBar1.Value == progressBar1.Maximum)
      // Stop the timer.
      time.Stop();
}
Private time As New Timer()

' Call this method from the constructor of the form.
Private Sub InitializeMyTimer()
   ' Set the interval for the timer.
   time.Interval = 250
   ' Connect the Tick event of the timer to its event handler.
   AddHandler time.Tick, AddressOf IncreaseProgressBar
   ' Start the timer.
   time.Start()
End Sub


Private Sub IncreaseProgressBar(ByVal sender As Object, ByVal e As EventArgs)
   ' Increment the value of the ProgressBar a value of one each time.
   ProgressBar1.Increment(1)
   ' Display the textual value of the ProgressBar in the StatusBar control's first panel.
   statusBarPanel1.Text = ProgressBar1.Value.ToString() + "% Completed"
   ' Determine if we have completed by comparing the value of the Value property to the Maximum value.
   If ProgressBar1.Value = ProgressBar1.Maximum Then
      ' Stop the timer.
      time.Stop()
   End If
End Sub

설명

속성의 Value 최소값과 최대값은 및 Maximum 속성에 Minimum 의해 지정됩니다. 이 속성을 사용하면 진행률 표시줄의 값을 직접 증가하거나 감소할 수 있습니다. 컨트롤 값 ProgressBar 의 일관된 증가를 수행하려면 메서드와 함께 PerformStep 속성을 사용할 Step 수 있습니다. 다양한 양만큼 진행률 표시줄 값을 늘리려면 메서드를 Increment 사용합니다.

적용 대상

추가 정보