ProgressBar.Minimum Özellik

Tanım

Denetim aralığının en küçük değerini alır veya ayarlar.

public:
 property int Minimum { int get(); void set(int value); };
public int Minimum { get; set; }
member this.Minimum : int with get, set
Public Property Minimum As Integer

Özellik Değeri

Int32

Aralığın en küçük değeri. Varsayılan değer, 0'dur.

Özel durumlar

özelliği için belirtilen değer 0'dan küçük.

Örnekler

Aşağıdaki kod örneği, dosya ProgressBar kopyalama işleminin ilerleme durumunu görüntülemek için bir denetim kullanır. Örnek, kopyalanacak dosya sayısına eşdeğer bir aralığı belirtmek için ProgressBar ve Maximum özelliklerini kullanırMinimum. Kod ayrıca dosyasının Step değerini ProgressBar dosya kopyalanırken artırmak için yöntemiyle özelliğini PerformStep kullanır. Bu örnek, içinde oluşturulan Formadlı pBar1 bir ProgressBar denetimin oluşturulmasını ve dosya kopyalama işlemini gerçekleştiren adlı CopyFile bir yöntemin (dosya kopyalama işleminin başarıyla tamamlandığını belirten boole değeri döndüren) olmasını gerektirir. Kod ayrıca kopyalanacak dosyaları içeren bir dize dizisinin oluşturulmasını ve örnekte tanımlanan yönteme CopyWithProgress geçirilmesini ve yönteminin içindeki başka bir yöntemden veya olaydan çağrılmayı Formgerektirir.

private:
   void CopyWithProgress( array<String^>^filenames )
   {
      // Display the ProgressBar control.
      pBar1->Visible = true;

      // Set Minimum to 1 to represent the first file being copied.
      pBar1->Minimum = 1;

      // Set Maximum to the total number of files to copy.
      pBar1->Maximum = filenames->Length;

      // Set the initial value of the ProgressBar.
      pBar1->Value = 1;

      // Set the Step property to a value of 1 to represent each file being copied.
      pBar1->Step = 1;

      // Loop through all files to copy.
      for ( int x = 1; x <= filenames->Length; x++ )
      {
         // Copy the file and increment the ProgressBar if successful.
         if ( CopyFile( filenames[ x - 1 ] ) == true )
         {
            // Perform the increment on the ProgressBar.
            pBar1->PerformStep();
         }
      }
   }
private void CopyWithProgress(string[] filenames)
{
    // Display the ProgressBar control.
    pBar1.Visible = true;
    // Set Minimum to 1 to represent the first file being copied.
    pBar1.Minimum = 1;
    // Set Maximum to the total number of files to copy.
    pBar1.Maximum = filenames.Length;
    // Set the initial value of the ProgressBar.
    pBar1.Value = 1;
    // Set the Step property to a value of 1 to represent each file being copied.
    pBar1.Step = 1;
    
    // Loop through all files to copy.
    for (int x = 1; x <= filenames.Length; x++)
    {
        // Copy the file and increment the ProgressBar if successful.
        if(CopyFile(filenames[x-1]) == true)
        {
            // Perform the increment on the ProgressBar.
            pBar1.PerformStep();
        }
    }
}
Private Sub CopyWithProgress(ByVal ParamArray filenames As String())
    ' Display the ProgressBar control.
    pBar1.Visible = True
    ' Set Minimum to 1 to represent the first file being copied.
    pBar1.Minimum = 1
    ' Set Maximum to the total number of files to copy.
    pBar1.Maximum = filenames.Length
    ' Set the initial value of the ProgressBar.
    pBar1.Value = 1
    ' Set the Step property to a value of 1 to represent each file being copied.
    pBar1.Step = 1

    ' Loop through all files to copy.
    Dim x As Integer
    for x = 1 To filenames.Length - 1
        ' Copy the file and increment the ProgressBar if successful.
        If CopyFile(filenames(x - 1)) = True Then
            ' Perform the increment on the ProgressBar.
            pBar1.PerformStep()
        End If
    Next x
End Sub

Açıklamalar

Bu özellik, özelliğin alt sınırını Value belirtir. Özelliğin Minimum değeri değiştirildiğinde, ProgressBar denetim yeni denetim aralığını yansıtacak şekilde yeniden çizilir. Özelliğin Value değeri özelliğin değerine Minimum eşit olduğunda ilerleme çubuğu boş olur. İlerleme çubuğunun değerini değiştirmek için yöntemini kullanarak özelliğini kullanınStep, yöntemini kullanın Increment veya özelliğin Value değerini doğrudan PerformStep ayarlayın.

Şunlara uygulanır

Ayrıca bkz.