다음을 통해 공유


ProgressBar.Minimum 속성

정의

컨트롤 범위의 최소값을 가져오거나 설정합니다.

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

속성 값

범위의 최소값입니다. 기본값은 0입니다.

예외

속성에 지정된 값이 0보다 작습니다.

예제

다음 코드 예제에서는 컨트롤을 ProgressBar 사용하여 파일 복사 작업의 진행률을 표시합니다. 이 예제에서는 및 Maximum 속성을 사용하여 Minimum 복사할 파일 수와 동일한 범위를 ProgressBar 지정합니다. 또한 이 코드는 메서드와 StepPerformStep 함께 속성을 사용하여 파일이 복사될 때의 ProgressBar 값을 증분합니다. 이 예제에서는 ProgressBar 파일 복사 작업을 수행하는 호출 pBar1 된 컨트롤을 만들고 Form파일 복사 작업이 성공적으로 완료되었음을 나타내는 부울 값을 반환하는 호출 CopyFile 된 메서드가 있어야 합니다. 또한 이 코드를 사용하려면 복사할 파일이 포함된 문자열 배열이 만들어지고 예제에 정의된 메서드에 CopyWithProgress 전달되어야 하며 메서드가 다른 메서드 또는 이벤트의 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 ] ))
         {
            // 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

설명

이 속성은 속성의 하한을 지정합니다 Value . 속성 값 Minimum 이 변경되면 컨트롤의 ProgressBar 새 범위를 반영하도록 컨트롤이 다시 그려집니다. 속성 값이 Value 속성 값 Minimum 과 같으면 진행률 표시줄이 비어 있습니다. 진행률 표시줄의 값을 변경하려면 메서드와 Step 함께 PerformStep 속성을 사용하거나, 메서드를 Increment 사용하거나, 속성 값을 Value 직접 설정합니다.

적용 대상

추가 정보