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

値の増減ボタンを表示するかどうかを示す System.Boolean 値を取得または設定します。
構文
Public Property ShowButtons As Boolean
public bool ShowButtons {get; set;}

プロパティ値

値の増減ボタンを表示するかどうかを示す System.Boolean 値。デフォルト値は false です。
使用例

次のサンプルコードは、ShowButtons プロパティの使用例と ButtonClick イベントの処理例を示します。

private void CreateGcTrackBarWithButtons()
{
    // 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 = Common.FlatStyleEx.Office2007Black;
    
    // Display the buttons and handle the ButtonClick event
    gcTrackBar1.ShowButtons = true;
    gcTrackBar1.ButtonClick += new EventHandler<TrackBarButtonClickEventArgs>(gcTrackBar1_ButtonClick);

    // Add gcTrackBar1 to the form
    this.Controls.Add(gcTrackBar1);
}
private void gcTrackBar1_ButtonClick(object sender, TrackBarButtonClickEventArgs e)
{
    // Set the Handle flag to skip the default button click logic
    e.Handled = true;

    // Customize the policy to change value when button clicked.
    GcTrackBar trackBar = sender as GcTrackBar;
    int newValue;
    if (e.IsIncrease)
    {
        newValue = Math.Min(trackBar.Value + 2, trackBar.Maximum);
    }
    else
    {
        newValue = Math.Max(trackBar.Value - 2, trackBar.Minimum);
    }
    trackBar.Value = newValue;
}
Private Sub CreateGcTrackBarWithButtons()
    ' 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.Office2007Black

    ' Display the buttons and handle the ButtonClick event
    gcTrackBar1.ShowButtons = True
    AddHandler gcTrackBar1.ButtonClick, AddressOf gcTrackBar1_ButtonClick

    ' Add gcTrackBar1 to the form
    Me.Controls.Add(gcTrackBar1)
End Sub
Private Sub gcTrackBar1_ButtonClick(ByVal sender As Object, ByVal e As TrackBarButtonClickEventArgs)
    ' Set the Handle flag to skip the default button click logic
    e.Handled = True

    ' Customize the policy to change value when button clicked.
    Dim trackBar = CType(sender, GcTrackBar)
    Dim newValue As Int32
    If e.IsIncrease Then
        newValue = Math.Min(trackBar.Value + 2, trackBar.Maximum)
    Else
        newValue = Math.Max(trackBar.Value - 2, trackBar.Minimum)
    End If
    trackBar.Value = newValue
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