ProgressBar.Minimum ProgressBar.Minimum ProgressBar.Minimum ProgressBar.Minimum Property

Definición

Obtiene o establece el valor mínimo del intervalo del control.Gets or sets the minimum value of the range of the control.

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

Valor de propiedad

Valor mínimo del intervalo.The minimum value of the range. El valor predeterminado es 0.The default is 0.

Excepciones

El valor especificado para la propiedad es menor que 0.The value specified for the property is less than 0.

Ejemplos

En el ejemplo de código siguiente ProgressBar se usa un control para mostrar el progreso de una operación de copia de archivos.The following code example uses a ProgressBar control to display the progress of a file copy operation. En el ejemplo se Minimum usan Maximum las propiedades y para ProgressBar especificar un intervalo para que sea equivalente al número de archivos que se van a copiar.The example uses the Minimum and Maximum properties to specify a range for the ProgressBar that is equivalent to the number of files to copy. El código también utiliza la Step propiedad con el PerformStep método para ProgressBar incrementar el valor de cuando se copia un archivo.The code also uses the Step property with the PerformStep method to increment the value of the ProgressBar as a file is copied. En este ejemplo se requiere que se ProgressBar cree un control pBar1 llamado Formque se crea en y que se ha creado un método denominado CopyFile (que devuelve un valor booleano que indica que la operación de copia de archivo fue se completó correctamente) que realiza la operación de copia de archivos.This example requires that you have a ProgressBar control created called pBar1 that is created within a Form, and that there is a method created called CopyFile (that returns a Boolean value indicating the file copy operation was completed successfully) that performs the file copy operation. El código también requiere que se cree una matriz de cadenas que contenga los archivos que se van a CopyWithProgress copiar y que se pase al método definido en el ejemplo, y que se llame al método desde Formotro método o evento de.The code also requires that an array of strings containing the files to copy is created and passed to the CopyWithProgress method defined in the example, and that the method is called from another method or event in the Form.

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

Comentarios

Esta propiedad especifica el límite inferior de la Value propiedad.This property specifies the lower limit of the Value property. Cuando se cambia el valor Minimum de la propiedad, el ProgressBar control vuelve a dibujarse para reflejar el nuevo intervalo del control.When the value of the Minimum property is changed, the ProgressBar control is redrawn to reflect the new range of the control. Cuando el valor de la Value propiedad es igual al valor de la Minimum propiedad, la barra de progreso está vacía.When the value of the Value property is equal to the value of the Minimum property, the progress bar is empty. Para cambiar el valor de la barra de progreso, utilice Step la propiedad con PerformStep el método, utilice Increment el método o establezca el valor de la Value propiedad directamente.To change the value of the progress bar, use the Step property with the PerformStep method, use the Increment method, or set the value of the Value property directly.

Se aplica a

Consulte también: