ProgressBar.PerformStep メソッドとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > ProgressBar.PerformStep メソッドの意味・解説 

ProgressBar.PerformStep メソッド

プログレス バー現在位置Step プロパティの量だけ進めます

名前空間: System.Windows.Forms
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)
構文構文

Dim instance As ProgressBar

instance.PerformStep
public void PerformStep ()
public:
void PerformStep ()
public void PerformStep ()
例外例外
例外種類条件

InvalidOperationException

StyleMarquee設定されています。

解説解説
使用例使用例

ProgressBar コントロール使用してファイルコピー操作進行状況表示するコード例次に示します。この例では、Minimum プロパティおよび Maximum プロパティ使用してコピーするファイル数に相当する ProgressBar範囲指定してます。このコードでは、ファイルコピー時に ProgressBar の値をインクリメントするために、PerformStep メソッドStep プロパティ使用します。この例では、Form 内に pBar1 という ProgressBar コントロール作成されており、ファイルコピー操作実行し操作正常終了したことを示すブール値を返す CopyFile というメソッド作成されている必要がありますまた、コピー対象ファイルを含む文字列配列作成され、この例の中で定義されている CopyWithProgress メソッドにその配列渡されており、そのメソッドForm別のメソッドまたはイベントから呼び出される必要もあります

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
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

ProgressBar.PerformStep メソッドのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



ProgressBar.PerformStep メソッドのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2024 Microsoft.All rights reserved.

©2024 GRAS Group, Inc.RSS