ProgressBar.Minimum Tulajdonság

Definíció

Lekéri vagy beállítja a vezérlőelem tartományának minimális értékét.

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

Tulajdonság értéke

A tartomány minimális értéke. Az alapértelmezett érték a 0.

Kivételek

A tulajdonsághoz megadott érték kisebb, mint 0.

Példák

Az alábbi példakód egy vezérlővel ProgressBar jeleníti meg a fájlmásolási művelet előrehaladását. A példa a Minimum tulajdonságokat használva Maximum a másolandó fájlok számával egyenértékű tartományt ProgressBar ad meg. A kód a Step tulajdonságot is használja a PerformStep metódussal a fájl másolásának értékének ProgressBar növeléséhez. Ehhez a példához létre kell hoznia egy ProgressBar vezérlőelemet, amely egy, a pBar1fájlmásolási műveletet végrehajtó metódust hoz létre FormCopyFile (amely egy logikai értéket ad vissza, amely azt jelzi, hogy a fájlmásolási művelet sikeresen befejeződött). A kódhoz emellett létre kell hoznia és továbbítania CopyWithProgress kell a példában meghatározott metódusnak a másolandó fájlokat tartalmazó sztringekből álló tömböt, és a metódust egy másik metódusból vagy eseményből kell meghívni a Formpéldában.

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 ] ))
         {
            // 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]))
        {
            // 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

Megjegyzések

Ez a tulajdonság a tulajdonság alsó korlátját Value határozza meg. A tulajdonság értékének Minimum módosításakor a ProgressBar vezérlő újrarajzolt lesz, hogy tükrözze a vezérlőelem új tartományát. Ha a Value tulajdonság értéke megegyezik a Minimum tulajdonság értékével, a folyamatjelző sáv üres. Az állapotsor értékének módosításához használja a Step tulajdonságot a PerformStep metódussal, használja a Increment metódust, vagy állítsa be közvetlenül a Value tulajdonság értékét.

A következőre érvényes:

Lásd még