Button.Placement 属性
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取或设置一个对象,该对象指示 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 值之一: xlFreeFloating。 xlMove. xlMoveAndSize.
示例
下面的代码示例将两 Button 个具有不同运行时行为的控件添加到工作表中。 第一个按钮涵盖单元格 B2 到 C3 的范围。 当用户在运行时调整此区域中的列或行的大小时,第一个按钮将调整大小以适应更改。 第二个按钮涵盖单元格 B5 到 C6 的范围,并且 Placement 此按钮的 属性设置为 xlFreeFloating。 当用户在运行时调整此区域中的列或行的大小时,第二个按钮不会更改大小。
此示例适用于文档级自定义项。
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