Hinweis
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, sich anzumelden oder das Verzeichnis zu wechseln.
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, das Verzeichnis zu wechseln.
Ruft den Mindestwert des Bereichs des Steuerelements ab oder legt diesen fest.
Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in system.windows.forms.dll)
Syntax
'Declaration
Public Property Minimum As Integer
'Usage
Dim instance As ProgressBar
Dim value As Integer
value = instance.Minimum
instance.Minimum = value
public int Minimum { get; set; }
public:
property int Minimum {
int get ();
void set (int value);
}
/** @property */
public int get_Minimum ()
/** @property */
public void set_Minimum (int value)
public function get Minimum () : int
public function set Minimum (value : int)
Eigenschaftenwert
Der Mindestwert des Bereichs. Der Standardwert ist 0 (null).
Ausnahmen
| Ausnahmetyp | Bedingung |
|---|---|
Der für die Eigenschaft angegebene Wert ist kleiner als 0 (null). |
Hinweise
Diese Eigenschaft gibt die Untergrenze der Value-Eigenschaft an. Wenn der Wert der Minimum-Eigenschaft geändert wird, wird das ProgressBar-Steuerelement neu gezeichnet, um den neuen Bereich des Steuerelements darzustellen. Wenn der Wert der Value-Eigenschaft gleich dem Wert der Minimum-Eigenschaft ist, ist die Statusanzeige leer. Um den Wert der Statusanzeige zu ändern, verwenden Sie die Increment-Methode, die Step-Eigenschaft mit der PerformStep-Methode ,oder legen Sie den Wert der Value-Eigenschaft direkt fest.
Beispiel
Im folgenden Codebeispiel wird anhand des ProgressBar-Steuerelements das Anzeigen des Fortschritts beim Kopieren von Dateien veranschaulicht. Im Beispiel werden die Minimum-Eigenschaft und die Maximum-Eigenschaft verwendet, um einen Bereich für die ProgressBar anzugeben, der der Anzahl der zu kopierenden Dateien entspricht. Im Code wird auch die Step-Eigenschaft mit der PerformStep-Methode verwendet, um den Wert von ProgressBar zu erhöhen, wenn eine Datei kopiert wurde. Für dieses Beispiel ist es erforderlich, dass Sie ein ProgressBar-Steuerelement mit dem Namen pBar1 in einem Form sowie eine Methode mit dem Namen CopyFile erstellt haben, die den Dateikopiervorgang durchführt. Diese Methode gibt einen booleschen Wert zurück, der die erfolgreiche Durchführung des Vorgangs angibt. Für diesen Code ist es außerdem erforderlich, dass ein Zeichenfolgenarray mit den zu kopierenden Dateien erstellt und an die im Beispiel definierte CopyWithProgress-Methode übergeben wird und die Methode von einer anderen Methode oder einem Ereignis im Form aufgerufen wird.
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
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:
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.set_Visible(true);
// Set Minimum to 1 to represent the first file being copied.
pBar1.set_Minimum(1);
// Set Maximum to the total number of files to copy.
pBar1.set_Maximum(fileNames.get_Length());
// Set the initial value of the ProgressBar.
pBar1.set_Value(1);
// Set the Step property to a value of 1 to represent each file
// being copied.
pBar1.set_Step(1);
// Loop through all files to copy.
for (int x = 1; x <= fileNames.get_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();
}
}
} //CopyWithProgress
Plattformen
Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile für Pocket PC, Windows Mobile für Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.
Versionsinformationen
.NET Framework
Unterstützt in: 2.0, 1.1, 1.0
.NET Compact Framework
Unterstützt in: 2.0, 1.0
Siehe auch
Referenz
ProgressBar-Klasse
ProgressBar-Member
System.Windows.Forms-Namespace
ProgressBar.Maximum-Eigenschaft
Value