PowerTools PlusPak for Windows Forms 8.0J
ValueRange プロパティ
使用例 

トラックバーコントロールのスライダーの値範囲を示す ValueRange を取得します。
構文
Public ReadOnly Property ValueRange As ValueRange
public ValueRange ValueRange {get;}

プロパティ値

すべてのスライダーの値範囲を示す ValueRange
使用例

次のサンプルコードは、GcTrackBar コントロールを含むフォームを表示し、トラックバーを使用して値の範囲を示す方法と ThumbValueRangeChanged イベントの処理例を示します。このサンプルを実行するには、TextBox1 という名前の System.Windows.Forms.TextBox コントロールを含むフォームに以下のコードを貼り付けて、フォームのコンストラクターまたは System.Windows.Forms.Form.Load イベント処理メソッドから CreateGcTrackBarWithRangeThumbs メソッドを呼び出します。

private void CreateGcTrackBarWithRangeThumbs()
{
    // Create a instance of GcTrackBar.
    GrapeCity.Win.Bars.GcTrackBar gcTrackBar1 = new GrapeCity.Win.Bars.GcTrackBar();

    // Initialize the Name, Location and Size of GcTrackBar
    gcTrackBar1.Name = "gcTrackBar1";
    gcTrackBar1.Location = new System.Drawing.Point(8, 8);
    gcTrackBar1.Size = new System.Drawing.Size(224, 45);

    gcTrackBar1.FlatStyle = GrapeCity.Win.Common.FlatStyleEx.Flat;
    gcTrackBar1.ThumbValueRangeChanged += new EventHandler<ThumbValueRangeChangedEventArgs>(gcTrackBar1_ValueRangeChanged);

    // Initialize the begin thumb
    Thumb beginThumb = new Thumb();
    beginThumb.Style = ThumbStyle.Begin;
    beginThumb.Value = 1;

    // Initialize the end thumb
    Thumb endThumb = new Thumb();
    endThumb.Style = ThumbStyle.End;
    endThumb.Value = 9;

    // Add thumbs to gcTrackBar1
    gcTrackBar1.Thumbs.Clear();
    gcTrackBar1.Thumbs.Add(beginThumb);
    gcTrackBar1.Thumbs.Add(endThumb);

    // Set the drag mode for range thumbs
    gcTrackBar1.DragMode = DragMode.Trunk;

    // Add gcTrackBar1 to the form
    this.Controls.Add(gcTrackBar1);
}
private void gcTrackBar1_ValueRangeChanged(object sender, ThumbValueRangeChangedEventArgs e)
{
    // Display the changed NewValaue of thumbs value range in the text box.
    this.textBox1.Text = "(" + e.NewValue.Begin.ToString() + "," + e.NewValue.End.ToString() + ")";
}
Private Sub CreateGcTrackBarWithRangeThumbs()
    ' Create a instance of GcTrackBar.
    Dim gcTrackBar1 As New GcTrackBar()

    ' Initialize the Name, Location and Size of GcTrackBar
    gcTrackBar1.Name = "gcTrackBar1"
    gcTrackBar1.Location = New System.Drawing.Point(8, 8)
    gcTrackBar1.Size = New System.Drawing.Size(224, 45)

    gcTrackBar1.FlatStyle = Global.GrapeCity.Win.Common.FlatStyleEx.Flat
    AddHandler gcTrackBar1.ThumbValueRangeChanged, AddressOf gcTrackBar1_ValueRangeChanged

    ' Initialize the begin thumb
    Dim beginThumb As New Thumb()
    beginThumb.Style = ThumbStyle.Begin
    beginThumb.Value = 1

    ' Initialize the end thumb
    Dim endThumb As New Thumb()
    endThumb.Style = ThumbStyle.End
    endThumb.Value = 9

    ' Add thumbs to gcTrackBar1
    gcTrackBar1.Thumbs.Clear()
    gcTrackBar1.Thumbs.Add(beginThumb)
    gcTrackBar1.Thumbs.Add(endThumb)

    ' Set the drag mode for range thumbs
    gcTrackBar1.DragMode = DragMode.Trunk

    ' Add gcTrackBar1 to the form
    Me.Controls.Add(gcTrackBar1)
End Sub
Private Sub gcTrackBar1_ValueRangeChanged(ByVal sender As Object, ByVal e As ThumbValueRangeChangedEventArgs)
    ' Display the changed NewValaue of thumbs value range in the text box.
    Me.textBox1.Text = "(" + e.NewValue.Begin.ToString() + "," + e.NewValue.End.ToString() + ")"
End Sub
プラットフォーム

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

参照

GcTrackBar クラス
GcTrackBar メンバ

Send Feedback