ProgressBar.Value Özellik

Tanım

İlerleme çubuğunun geçerli konumunu alır veya ayarlar.

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

Özellik Değeri

İlerleme çubuğunun aralığındaki konum. Varsayılan değer 0’dır.

Öznitelikler

Özel durumlar

Belirtilen değer özelliğin değerinden Maximum büyük.

-veya-

Belirtilen değer özelliğin değerinden Minimum küçük.

Örnekler

Aşağıdaki kod örneği, bir durumunda değerini artırmak için yönteminin ve Increment özelliğinin ValueProgressBarTick nasıl kullanılacağını Timer gösterir. Örnek ayrıca öğesinin Value metinsel gösterimini StatusBarPanelsağlamak için içinde özelliğini ProgressBar görüntüler. Bu örnekte, adlı bir ProgressBar denetiminiz ve progressBar1 adlı StatusBaröğesini içeren bir StatusBarPanelstatusBarPanel1denetiminiz olması gerekir. Timeradlı time, forma üye olarak eklenmelidir.

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

Açıklamalar

Özelliğin Value en düşük ve en büyük değerleri ve Minimum özellikleri tarafından Maximum belirtilir. Bu özellik, ilerleme çubuğunun değerini doğrudan artırmanıza veya azaltmanıza olanak tanır. Denetimin değerinde ProgressBar tutarlı artışlar gerçekleştirmek için yöntemini kullanarak Step özelliğini kullanabilirsinizPerformStep. İlerleme çubuğu değerini farklı tutarlarla artırmak için yöntemini kullanın Increment .

Şunlara uygulanır

Ayrıca bkz.