แก้ไข

แชร์ผ่าน


ToolStripProgressBar.Maximum Property

Definition

Gets or sets the upper bound of the range that is defined for this ToolStripProgressBar.

public:
 property int Maximum { int get(); void set(int value); };
public int Maximum { get; set; }
member this.Maximum : int with get, set
Public Property Maximum As Integer

Property Value

An integer representing the upper bound of the range. The default is 100.

Examples

The following code example demonstrates a use of the Maximum property in a ToolStripProgressBar that calculates a sequence of Fibonacci numbers. This code example is part of a larger example that provided for the ToolStripProgressBar class.

requestedCountControl = new NumericUpDown();
requestedCountControl.Maximum = 1000;
requestedCountControl.Minimum = 1;
requestedCountControl.Value = 100;
flp.Controls.Add(requestedCountControl);
requestedCountControl = New NumericUpDown()
requestedCountControl.Maximum = 1000
requestedCountControl.Minimum = 1
requestedCountControl.Value = 100
flp.Controls.Add(requestedCountControl)

Remarks

This property specifies the upper limit of the Value property. When the value of the Maximum property is changed, the ToolStripProgressBar control is redrawn to reflect the new range of the control. When the value of the Value property is equal to the value of the Maximum property, the progress bar is completely filled.

You can use this property to specify a value that the Value property must be set to (by setting the Value property or using the Increment or PerformStep methods) to indicate that an operation is complete. For example, you can set the value of the Maximum property to the total number of files in a file copy operation. Each time a file is copied, the Value property can be increased by one until the total number of files is copied. At that point, the progress bar would be completely filled.

Applies to