PowerTools InputMan for Windows Forms 8.0J
SideButtons プロパティ (GcTimeSpan)
使用例 

コントロールに設定されているサイドボタンのコレクションを取得します。
構文
Public ReadOnly Property SideButtons As SideButtonCollection
public SideButtonCollection SideButtons {get;}

プロパティ値

サイドボタンのコレクションを表すSideButtonCollection オブジェクト。
解説
SideButtonsにはいくつかのコマンドボタンを追加または削除できます。これには、DropDownButtonSpinButtonSideButton、およびSymbolButtonが含まれます。
使用例
サイドボタンと入力フィールドを設定した GcTimeSpan コントロールを作成するコード例を次に示します。サイドボタンクリック時にコントロールの値が変化します。この例では他に SideButtons、 Fields プロパティと DoSpinUp(TimeSpan)DoSpinDown(TimeSpan) メソッドを使用しています。
//  Please use the following namespace
//  using System.Windows.Forms;
//  using GrapeCity.Win.Editors;
//  using GrapeCity.Win.Editors.Fields;

// Creates an instance of a GcTimeSpan control.
GcTimeSpan gcTimeSpan1 = new GcTimeSpan();
public void InitializeGcTimeSpan()
{
    // Sets the Fields settings.
    gcTimeSpan1.Fields.Clear();
    gcTimeSpan1.Fields.AddRange(@"hh:mm:ss",2,'.',string.Empty,string.Empty,"-",string.Empty);

    // Defines SymbolButtons.
    SymbolButton symbolButton1 = new GrapeCity.Win.Editors.SymbolButton();
    SymbolButton symbolButton2 = new GrapeCity.Win.Editors.SymbolButton();
    symbolButton1.Name = "symbolButton1";
    symbolButton1.Position = GrapeCity.Win.Editors.ButtonPosition.LeftOutside;
    symbolButton1.Symbol = GrapeCity.Win.Editors.Symbols.Arrow;
    symbolButton1.SymbolDirection = GrapeCity.Win.Editors.SymbolDirection.Up;
    symbolButton1.UseVisualStyleBackColor = true;
    symbolButton1.Click += new EventHandler(OnSymbolButton1Click);
    symbolButton2.Name = "symbolButton2";
    symbolButton2.Position = GrapeCity.Win.Editors.ButtonPosition.RightOutside;
    symbolButton2.Symbol = GrapeCity.Win.Editors.Symbols.Arrow;
    symbolButton2.SymbolDirection = GrapeCity.Win.Editors.SymbolDirection.Down;
    symbolButton2.Click += new EventHandler(OnSymbolButton2Click);

    // Adds SymbolButtons to the SideButtons collection.
    gcTimeSpan1.SideButtons.AddRange(new GrapeCity.Win.Editors.SideButtonBase[] {
    symbolButton1,
    symbolButton2});
}

private void OnSymbolButton2Click(object sender, EventArgs e)
{
    // Spin the GcTimeSpan value to the less one.
    gcTimeSpan1.DoSpinDown(new TimeSpan(1, 0, 0, 0));
}

private void OnSymbolButton1Click(object sender, EventArgs e)
{
    // Spin the GcTimeSpan value to the greater one.
    gcTimeSpan1.DoSpinUp(new TimeSpan(1, 0, 0, 0));
}
'  Please use the following namespace
'  Imports System.Windows.Forms;
'  Imports GrapeCity.Win.Editors;
'  Imports GrapeCity.Win.Editors.Fields;

' Creates an instance of a GcTimeSpan control.
Private gcTimeSpan1 As New GcTimeSpan()
Public Sub InitializeGcTimeSpan()
    ' Sets the Fields settings.
    gcTimeSpan1.Fields.Clear()
    gcTimeSpan1.Fields.AddRange("hh:mm:ss", 2, "."c, String.Empty, String.Empty, "-", _
     String.Empty)

    ' Defines SymbolButtons.
    Dim symbolButton1 As SymbolButton = New GrapeCity.Win.Editors.SymbolButton()
    Dim symbolButton2 As SymbolButton = New GrapeCity.Win.Editors.SymbolButton()
    symbolButton1.Name = "symbolButton1"
    symbolButton1.Position = GrapeCity.Win.Editors.ButtonPosition.LeftOutside
    symbolButton1.Symbol = GrapeCity.Win.Editors.Symbols.Arrow
    symbolButton1.SymbolDirection = GrapeCity.Win.Editors.SymbolDirection.Up
    symbolButton1.UseVisualStyleBackColor = True
    AddHandler symbolButton1.Click, AddressOf OnSymbolButton1Click
    symbolButton2.Name = "symbolButton2"
    symbolButton2.Position = GrapeCity.Win.Editors.ButtonPosition.RightOutside
    symbolButton2.Symbol = GrapeCity.Win.Editors.Symbols.Arrow
    symbolButton2.SymbolDirection = GrapeCity.Win.Editors.SymbolDirection.Down
    AddHandler symbolButton2.Click, AddressOf OnSymbolButton2Click

    ' Adds SymbolButtons to the SideButtons collection.
    gcTimeSpan1.SideButtons.AddRange(New GrapeCity.Win.Editors.SideButtonBase() {symbolButton1, symbolButton2})
End Sub

Private Sub OnSymbolButton2Click(ByVal sender As Object, ByVal e As EventArgs)
    ' Spin the GcTimeSpan value to the less one.
    gcTimeSpan1.DoSpinDown(New TimeSpan(1, 0, 0, 0))
End Sub

Private Sub OnSymbolButton1Click(ByVal sender As Object, ByVal e As EventArgs)
    ' Spin the GcTimeSpan value to the greater one.
    gcTimeSpan1.DoSpinUp(New TimeSpan(1, 0, 0, 0))
End Sub
参照

GcTimeSpan クラス
GcTimeSpan メンバ

 

 


© 2004-2015 GrapeCity inc. All rights reserved.