ProgressBar.Value プロパティ
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)

プログレス バーの範囲内の位置。既定値は 0 です。


Value プロパティの最小値および最大値は、Minimum プロパティおよび Maximum プロパティで指定します。このプロパティを使用すると、プログレス バーの値を直接インクリメントまたはデクリメントできます。ProgressBar コントロールの値を一定の量ずつ増やすには、PerformStep メソッドで Step プロパティを使用します。プログレス バーの値を増分量を変化させて増やすには、Increment メソッドを使用します。

Increment メソッドと Value プロパティを使用して、Timer の Tick イベントで ProgressBar の値をインクリメントするコード例を次に示します。またこの例では、StatusBarPanel に Value プロパティを表示して、ProgressBar をテキストで表します。この例では、progressBar1 という名前の ProgressBar コントロール、および statusBarPanel1 という名前の StatusBarPanel が配置された StatusBar コントロールが存在する必要があります。また、time という名前の Timer を、メンバとしてフォームに追加する必要があります。
Private time As New Timer() ' Call this method from the constructor of the form. Private Sub InitializeMyTimer() ' Set the interval for the timer. time.Interval = 250 ' Connect the Tick event of the timer to its event handler. AddHandler time.Tick, AddressOf IncreaseProgressBar ' Start the timer. time.Start() End Sub Private Sub IncreaseProgressBar(ByVal sender As Object, ByVal e As EventArgs) ' Increment the value of the ProgressBar a value of one each time. ProgressBar1.Increment(1) ' Display the textual value of the ProgressBar in the StatusBar control's first panel. statusBarPanel1.Text = ProgressBar1.Value.ToString() + "% Completed" ' Determine if we have completed by comparing the value of the Value property to the Maximum value. If ProgressBar1.Value = ProgressBar1.Maximum Then ' Stop the timer. time.Stop() End If End Sub
private Timer time = new Timer(); // Call this method from the constructor of the form. private void InitializeMyTimer() { // Set the interval for the timer. time.Interval = 250; // Connect the Tick event of the timer to its event handler. time.Tick += new EventHandler(IncreaseProgressBar); // Start the timer. time.Start(); } private void IncreaseProgressBar(object sender, EventArgs e) { // Increment the value of the ProgressBar a value of one each time. progressBar1.Increment(1); // Display the textual value of the ProgressBar in the StatusBar control's first panel. statusBarPanel1.Text = progressBar1.Value.ToString() + "% Completed"; // Determine if we have completed by comparing the value of the Value property to the Maximum value. if (progressBar1.Value == progressBar1.Maximum) // Stop the timer. time.Stop(); }
private: Timer^ time; // Call this method from the constructor of the form. void InitializeMyTimer() { // Set the interval for the timer. time->Interval = 250; // Connect the Tick event of the timer to its event handler. time->Tick += gcnew EventHandler( this, &Form1::IncreaseProgressBar ); // Start the timer. time->Start(); } void IncreaseProgressBar( Object^ /*sender*/, EventArgs^ /*e*/ ) { // Increment the value of the ProgressBar a value of one each time. progressBar1->Increment( 1 ); // Display the textual value of the ProgressBar in the StatusBar control's first panel. statusBarPanel1->Text = String::Concat( progressBar1->Value, "% Completed" ); // Determine if we have completed by comparing the value of the Value property to the Maximum value. if ( progressBar1->Value == progressBar1->Maximum ) // Stop the timer. time->Stop(); }
private Timer time = new Timer(); // Call this method from the constructor of the form. private void InitializeMyTimer() { // Set the interval for the timer. time.set_Interval(250); // Connect the Tick event of the timer to its event handler. time.add_Tick(new EventHandler(IncreaseProgressBar)); // Start the timer. time.Start(); } //InitializeMyTimer private void IncreaseProgressBar(Object sender, EventArgs e) { // Increment the value of the ProgressBar a value of one each time. progressBar1.Increment(1); // Display the textual value of the ProgressBar in the StatusBar // control's first panel. statusBarPanel1.set_Text(progressBar1.get_Value() + "% Completed"); // Determine if we have completed by comparing the value of the Value // property to the Maximum value. if (progressBar1.get_Value() == progressBar1.get_Maximum()) { // Stop the timer. time.Stop(); } } //IncreaseProgressBar

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


ProgressBar クラス
ProgressBar メンバ
System.Windows.Forms 名前空間
ProgressBar.Maximum プロパティ
ProgressBar.Minimum プロパティ
- ProgressBar.Value プロパティのページへのリンク