PowerTools PlusPak for Windows Forms 8.0J
SelectedThumbIndexChanged イベント
使用例 

SelectedThumbIndex プロパティの値が変更されたときに発生します。
構文
Public Event SelectedThumbIndexChanged As EventHandler
public event EventHandler SelectedThumbIndexChanged
使用例

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

private void CreateGcTrackBarWithIndexChanged()
{
    // 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.SelectedThumbIndexChanged += new EventHandler(gcTrackBar1_SelectedThumbIndexChanged);

    // Add the second Thumb to the Thumbs of GcTrackBar
    GrapeCity.Win.Bars.Thumb thumb1 = new GrapeCity.Win.Bars.Thumb();
    thumb1.ToolTip = "#0cm";
    gcTrackBar1.Thumbs.Add(thumb1);

    gcTrackBar1.FlatStyle = GrapeCity.Win.Common.FlatStyleEx.Professional;

    // Add gcTrackBar1 to the form
    this.Controls.Add(gcTrackBar1);
}

void gcTrackBar1_SelectedThumbIndexChanged(object sender, EventArgs e)
{
    // Display the vlaue of current selected Thumb in the text box.
    GcTrackBar trackbar = (GcTrackBar)sender;
    GrapeCity.Win.Bars.Thumb selectedThumb = trackbar.Thumbs[trackbar.SelectedThumbIndex];
    this.textBox1.Text =  "Thumb" + trackbar.SelectedThumbIndex.ToString() + "'s value is " + selectedThumb.Value;
}
Private Sub CreateGcTrackBarWithIndexChanged()
    ' 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)
    AddHandler gcTrackBar1.SelectedThumbIndexChanged, AddressOf gcTrackBar1_SelectedThumbIndexChanged

    ' Add the second Thumb to the Thumbs of GcTrackBar
    Dim thumb1 As New Thumb()
    thumb1.ToolTip = "#0cm"
    gcTrackBar1.Thumbs.Add(thumb1)

    gcTrackBar1.FlatStyle = Global.GrapeCity.Win.Common.FlatStyleEx.Professional

    ' Add gcTrackBar1 to the form
    Me.Controls.Add(gcTrackBar1)
End Sub

Private Sub gcTrackBar1_SelectedThumbIndexChanged(ByVal sender As Object, ByVal e As EventArgs)
    ' Display the vlaue of current selected Thumb in the text box.
    Dim trackbar As GcTrackBar = DirectCast(sender, GcTrackBar)
    Dim selectedThumb As Thumb = trackbar.Thumbs(trackbar.SelectedThumbIndex)
    Me.textBox1.Text = "Thumb" + trackbar.SelectedThumbIndex.ToString() + "'s value is " + selectedThumb.Value.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