Button.Placement Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets or sets an object that indicates the way the Button is attached to the cells below it.
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
Property Value
One of the following XlPlacement values: xlFreeFloating. xlMove. xlMoveAndSize.
Examples
The following code example adds two Button controls that have different run-time behavior to a worksheet. The first button covers the range of cells B2 through C3. When the user resizes a column or row in this range at run time, the first button will resize to adjust to the changes. The second button covers the range of cells B5 through C6, and the Placement property of this button is set to xlFreeFloating. When the user resizes a column or row in this range at run time, the second button will not change size.
This example is for a document-level customization.
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