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

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

プロパティ値

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

// Creates an instance of a GcNumber control.
GcNumber gcNumber1 = new GcNumber();
public void InitializeGcNumber()
{
    // Sets the Felds property.
    gcNumber1.Fields.DecimalPart.MaxDigits = 2;
    gcNumber1.Fields.DecimalPart.MinDigits = 2;
    gcNumber1.Fields.IntegerPart.GroupSizes = new int[] {3,3,0};
    gcNumber1.Fields.IntegerPart.MaxDigits = 9;
    gcNumber1.Fields.IntegerPart.MinDigits = 1;

    // 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.
    gcNumber1.SideButtons.AddRange(new GrapeCity.Win.Editors.SideButtonBase[] {
    symbolButton1,
    symbolButton2});
}

private void OnSymbolButton2Click(object sender, EventArgs e)
{
    // Spin the GcNumber value to the less one.
    gcNumber1.DoSpinDown(1m);
}

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

' Creates an instance of a GcNumber control.
Private gcNumber1 As New GcNumber()
Public Sub InitializeGcNumber()
    ' Sets the Felds property.
    gcNumber1.Fields.DecimalPart.MaxDigits = 2
    gcNumber1.Fields.DecimalPart.MinDigits = 2
    gcNumber1.Fields.IntegerPart.GroupSizes = New Integer() {3, 3, 0}
    gcNumber1.Fields.IntegerPart.MaxDigits = 9
    gcNumber1.Fields.IntegerPart.MinDigits = 1

    ' 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.
    gcNumber1.SideButtons.AddRange(New GrapeCity.Win.Editors.SideButtonBase() {symbolButton1, symbolButton2})
End Sub

Private Sub OnSymbolButton2Click(ByVal sender As Object, ByVal e As EventArgs)
    ' Spin the GcNumber value to the less one.
    gcNumber1.DoSpinDown(1D)
End Sub

Private Sub OnSymbolButton1Click(ByVal sender As Object, ByVal e As EventArgs)
    ' Spin the GcNumber value to the greater one.
    gcNumber1.DoSpinUp(1D)
End Sub
参照

GcNumber クラス
GcNumber メンバ

 

 


© 2004-2015 GrapeCity inc. All rights reserved.