ProgressBar.Minimum プロパティ
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
コントロールの範囲の最小値を取得または設定します。
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 コントロールを使用して、ファイル コピー操作の進行状況を表示します。 この例では、 Minimum プロパティと Maximum プロパティを使用して、コピーするファイルの数と等しい ProgressBar の範囲を指定します。 また、PerformStep メソッドと共に Step プロパティを使用して、ファイルのコピー時にProgressBarの値をインクリメントします。 この例では、Form内に作成されたpBar1と呼ばれるProgressBar コントロールを作成し、ファイル コピー操作を実行する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 プロパティの値と等しい場合、進行状況バーは空です。 進行状況バーの値を変更するには、PerformStep メソッドで Step プロパティを使用するか、Increment メソッドを使用するか、Value プロパティの値を直接設定します。