次の方法で共有


Button.Placement プロパティ

Button を下にあるセルに結合する方法を示すオブジェクトを取得または設定します。

名前空間:  Microsoft.Office.Tools.Excel.Controls
アセンブリ:  Microsoft.Office.Tools.Excel.v4.0.Utilities (Microsoft.Office.Tools.Excel.v4.0.Utilities.dll 内)

構文

'宣言
Public Property Placement As Object
public Object Placement { get; set; }

プロパティ値

型 : System.Object

次のいずれかの XlPlacement 値です。

次のコード例では、実行時にワークシートに対して異なる動作をする 2 つの Button コントロールを追加します。 最初のボタンは、セル B2 から C3 までの範囲をカバーします。 実行時に、ユーザーがこの範囲に含まれる列または行のサイズを変更すると、この変更に合わせて、最初のボタンのサイズが変更されます。 2 番目のボタンは、セル B5 から C6 までの範囲をカバーします。また、このボタンの Placement プロパティは xlFreeFloating に設定されます。 実行時に、ユーザーがこの範囲に含まれる列または行のサイズを変更しても、2 番目のボタンのサイズは変化しません。

この例は、ドキュメント レベルのカスタマイズ用に作成されています。

Private Sub ComparePlacementBehavior()

    Dim CellButton As Microsoft.Office.Tools.Excel.Controls.Button = _
        Me.Controls.AddButton(Me.Range("B2", "C3"), "CellButton")
    CellButton.Text = "Resizes with cells"

    Dim FixedButton As Microsoft.Office.Tools.Excel.Controls.Button = _
        Me.Controls.AddButton(Me.Range("B5", "C6"), "FixedButton")
    FixedButton.Text = "Does not resize"
    FixedButton.Placement = Excel.XlPlacement.xlFreeFloating
End Sub
private void ComparePlacementBehavior()
{
    Microsoft.Office.Tools.Excel.Controls.Button cellButton =
        this.Controls.AddButton(this.Range["B2", "C3"],
        "cellButton");
    cellButton.Text = "Resizes with cells";

    Microsoft.Office.Tools.Excel.Controls.Button fixedButton =
        this.Controls.AddButton(this.Range["B5", "C6"],
        "fixedButton");
    fixedButton.Text = "Does not resize";
    fixedButton.Placement = Excel.XlPlacement.xlFreeFloating;
}

.NET Framework セキュリティ

  • 直前の呼び出し元に対する完全な信頼。このメンバーは、部分的に信頼されているコードから使用することはできません。詳細については、「部分信頼コードからのライブラリの使用」を参照してください。

参照

関連項目

Button クラス

Microsoft.Office.Tools.Excel.Controls 名前空間