次の方法で共有


Button.Placement プロパティ

定義

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

public:
 property System::Object ^ Placement { System::Object ^ get(); void set(System::Object ^ value); };
public object Placement { get; set; }
member this.Placement : obj with get, set
Public Property Placement As Object

プロパティ値

XlPlacement のいずれかの値: xlFreeFloatingxlMove. xlMoveAndSize.

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

この例は、ドキュメント レベルのカスタマイズ用です。

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;
}
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

適用対象