GrapeCity.Win.Bars 名前空間 > GcTrackBar クラス : Thumbs プロパティ |
Public ReadOnly Property Thumbs As ThumbCollection
public ThumbCollection Thumbs {get;}
次のサンプルコードは、3 つの Thumb がある GcTrackBar コントロールを含むフォームを表示し、ToolTip をカスタマイズする方法と ThumbValueChanged イベントの処理例を示します。このサンプルを実行するには、TextBox1 という名前の System.Windows.Forms.TextBox コントロールを含むフォームに以下のコードを貼り付けて、フォームのコンストラクターまたは System.Windows.Forms.Form.Load イベント処理メソッドから CreateGcTrackBarWithMultiThumbs メソッドを呼び出します。
private void CreateGcTrackBarWithMultiThumbs() { // Create a instance of GcTrackBar. GrapeCity.Win.Bars.GcTrackBar gcTrackBar3 = new GrapeCity.Win.Bars.GcTrackBar(); // Initialize the Name, Location and Size of GcTrackBar gcTrackBar3.Name = "gcTrackBar2"; gcTrackBar3.Location = new System.Drawing.Point(8, 8); gcTrackBar3.Size = new System.Drawing.Size(224, 45); gcTrackBar3.ThumbValueChanged += new EventHandler<ThumbValueChangedEventArgs>(gcTrackBar3_ThumbValueChanged); // Set ToolTip for the default thumb. GrapeCity.Win.Bars.Thumb thumb1 = gcTrackBar3.Thumbs[0]; thumb1.ToolTip = "#0cm"; // Add the second Thumb to the Thumbs of GcTrackBar GrapeCity.Win.Bars.Thumb thumb2 = new GrapeCity.Win.Bars.Thumb(); thumb2.ToolTip = "#0cm"; thumb2.Value = 1; gcTrackBar3.Thumbs.Add(thumb2); // Add the third Thumb to the Thumbs of GcTrackBar GrapeCity.Win.Bars.Thumb thumb3 = new GrapeCity.Win.Bars.Thumb(); thumb3.ToolTip = "#0cm"; thumb3.Value = 2; gcTrackBar3.Thumbs.Add(thumb3); // Add gcTrackBar1 to the form this.Controls.Add(gcTrackBar3); } void gcTrackBar3_ThumbValueChanged(object sender, ThumbValueChangedEventArgs e) { // Display the changed NewValaue of current selected Thumb in the text box. this.textBox1.Text = "" + e.NewValue; }
Private Sub CreateGcTrackBarWithMultiThumbs() ' Create a instance of GcTrackBar. Dim gcTrackBar3 As New GcTrackBar() ' Initialize the Name, Location and Size of GcTrackBar gcTrackBar3.Name = "gcTrackBar2" gcTrackBar3.Location = New System.Drawing.Point(8, 8) gcTrackBar3.Size = New System.Drawing.Size(224, 45) AddHandler gcTrackBar3.ThumbValueChanged, AddressOf gcTrackBar3_ThumbValueChanged ' Set ToolTip for the default thumb. Dim thumb1 As Thumb = gcTrackBar3.Thumbs(0) thumb1.ToolTip = "#0cm" ' Add the second Thumb to the Thumbs of GcTrackBar Dim thumb2 As New Thumb() thumb2.ToolTip = "#0cm" thumb2.Value = 1 gcTrackBar3.Thumbs.Add(thumb2) ' Add the third Thumb to the Thumbs of GcTrackBar Dim thumb3 As New Thumb() thumb3.ToolTip = "#0cm" thumb3.Value = 2 gcTrackBar3.Thumbs.Add(thumb3) ' Add gcTrackBar1 to the form Me.Controls.Add(gcTrackBar3) End Sub Private Sub gcTrackBar3_ThumbValueChanged(ByVal sender As Object, ByVal e As ThumbValueChangedEventArgs) ' Display the changed NewValaue of current selected Thumb in the text box. Me.textBox1.Text = "" + e.NewValue.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