다음을 통해 공유


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 값 중 하나입니다.

예제

다음 코드 예제에서는 런타임 동작이 서로 다른 두 개의 Button 컨트롤을 워크시트에 추가합니다.첫 번째 단추는 B2 셀에서 C3 셀까지를 포함합니다.사용자가 런타임에 이 범위의 열이나 행을 크기 조정하면 첫 번째 단추는 변경 사항에 맞게 크기가 조정됩니다.두 번째 단추는 B5 셀에서 C6 셀까지를 포함하며 이 단추의 Placement 속성은 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
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 네임스페이스