ProgressBar.Value ProgressBar.Value ProgressBar.Value ProgressBar.Value Property

정의

진행률 표시줄의 현재 위치를 가져오거나 설정합니다.Gets or sets the current position of the progress bar.

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

속성 값

진행률 표시줄의 범위 내에 있는 위치입니다.The position within the range of the progress bar. 기본값은 0입니다.The default is 0.

예외

지정 된 값의 값 보다 크면는 Maximum 속성입니다.The value specified is greater than the value of the Maximum property.

또는-or- 지정 된 값을 사용 하면 값 보다 작으면는 Minimum 속성입니다.The value specified is less than the value of the Minimum property.

예제

다음 코드 예제에 사용 하는 방법을 보여 줍니다.는 Increment 메서드 및 Value 속성의 값을 증분을 ProgressBarTick 의 이벤트를 Timer.The following code example demonstrates how to use the Increment method and the Value property to increment the value of a ProgressBar in the Tick event of a Timer. 표시 합니다는 Value 에서 속성을 StatusBarPanel 의 텍스트 표현을 제공 하는 ProgressBar합니다.The example also displays the Value property in a StatusBarPanel to provide a textual representation of the ProgressBar. 이 예제를 실행 하려면를 ProgressBar 라는 컨트롤 progressBar1, 및 StatusBar 포함 된 컨트롤을 StatusBarPanel명명 된 statusBarPanel1합니다.This example requires that you have a ProgressBar control, named progressBar1, and a StatusBar control that contains a StatusBarPanel, named statusBarPanel1. 합니다 Timer명명 된 time를 구성원으로 폼에 추가 해야 합니다.The Timer, named time, must be added to the form as a member.

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 속성으로 지정 된 합니다 MinimumMaximum 속성.The minimum and maximum values of the Value property are specified by the Minimum and Maximum properties. 이 속성을 사용 하면 증가 시키거나 진행률 표시줄을 직접 값을 감소 시킬 수 있습니다.This property enables you to increment or decrement the value of the progress bar directly. 값에 일관 된 증가 하는 데는 ProgressBar 컨트롤을 사용할 수는 Step 속성과 PerformStep 메서드.To perform consistent increases in the value of the ProgressBar control you can use the Step property with the PerformStep method. 진행률 표시줄 값을 다양 한 크기를 높이려면는 Increment 메서드.To increase the progress bar value by varying amounts, use the Increment method.

적용 대상

추가 정보