PowerTools PlusPak for Windows Forms 8.0J
FlatAppearance プロパティ (SideButtonBase)
使用例 

チェック状態とマウス状態を示すために使用される境界線の外観と色を取得します。
構文
Public ReadOnly Property FlatAppearance As FlatButtonAppearance
public FlatButtonAppearance FlatAppearance {get;}

プロパティ値

GrapeCity.Win.Buttons.FlatButtonAppearance値の1つ。
解説
FlatAppearanceプロパティは、SideButtonを含むGrapeCity.Win.Containers.GcComboFrameFlatStyleFlatStyleEx.Flatである場合にのみ使用してください。
使用例

次のサンプルコードは、SideButtonを作成し、FlatAppearanceのプロパティを設定します。これらの設定は、SideButtonを含むGrapeCity.Win.Containers.GcComboFrameFlatStyleFlatStyleEx.Flatである場合にのみ適用されます。

このサンプルコードは、GrapeCity.Win.Containers.GcComboFrameクラスの概要に示されている詳細なコード例の一部を抜粋したものです。その元の例では、最初にcomboBox1からSideButton項目を選択してgcComboFrame1にSideButtonを表示できます。次に、gcComboFrame1のテキストエディタにテキストを入力してSideButtonをクリックすると、新しい項目がlistBox1に追加されます。

// Returns a SideButton instance for gcComboFrame1.
private SideButtonBase CreateSideButton()
{
    SideButton sideButton = new SideButton();

    // Specify a unique name for this button.
    sideButton.Name = "SideButton";

    // Set button text.
    sideButton.Text = "Add a item";

    // Set button's width.
    sideButton.ButtonWidth = 70;

    // Set this side button not to show in GcComboFrame.
    sideButton.Visible = ButtonVisibility.NotShown;

    // Set this side button to position at outside of GcComboFrame's right border.
    sideButton.Position = ButtonPosition.RightOutside;

    // Set the fat appearance for this button, and these settings will take effect when 
    // its associated GcComboFrame's FlatStyle is Flat.
    sideButton.FlatAppearance.BorderColor = Color.Red;
    sideButton.FlatAppearance.BorderSize = 2;
    sideButton.FlatAppearance.CheckedBackColor = Color.Blue;
    sideButton.FlatAppearance.MouseDownBackColor = Color.Yellow;
    sideButton.FlatAppearance.MouseOverBackColor = Color.Green;

    sideButton.Click += new EventHandler(SideButton_Click);

    return sideButton;
}

// Add a item into listBox1 when SideButton is clicked.
private void SideButton_Click(object sender, EventArgs e)
{
    if (this.textBox1.Text != string.Empty)
    {
        this.listBox1.Items.Add(this.textBox1.Text);
        this.textBox1.Clear();
    }
    else
    {
        MessageBox.Show("You must input a string first !");
    }
}
' Returns a SideButton instance for gcComboFrame1.
Private Function CreateSideButton() As SideButtonBase
    Dim sideButton As New SideButton()

    ' Specify a unique name for this button.
    sideButton.Name = "SideButton"

    ' Set button text.
    sideButton.Text = "Add a item"

    ' Set button's width.
    sideButton.ButtonWidth = 70

    ' Set this side button not to show in GcComboFrame.
    sideButton.Visible = ButtonVisibility.NotShown

    ' Set this side button to position at outside of GcComboFrame's right border.
    sideButton.Position = ButtonPosition.RightOutside

    ' Set the fat appearance for this button, and these settings will take effect when 
    ' its associated GcComboFrame's FlatStyle is Flat.
    sideButton.FlatAppearance.BorderColor = Color.Red
    sideButton.FlatAppearance.BorderSize = 2
    sideButton.FlatAppearance.CheckedBackColor = Color.Blue
    sideButton.FlatAppearance.MouseDownBackColor = Color.Yellow
    sideButton.FlatAppearance.MouseOverBackColor = Color.Green

    AddHandler sideButton.Click, AddressOf SideButton_Click

    Return sideButton
End Function

' Add a item into listBox1 when SideButton is clicked.
Private Sub SideButton_Click(ByVal sender As Object, ByVal e As EventArgs)
    If Me.textBox1.Text <> String.Empty Then
        Me.listBox1.Items.Add(Me.textBox1.Text)
        Me.textBox1.Clear()
    Else
        MessageBox.Show("You must input a string first !")
    End If
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

参照

SideButtonBase クラス
SideButtonBase メンバ

Send Feedback