다음을 통해 공유


ControlCollection.GetInlineShapeForControl 메서드

지정된 컨트롤에 대한 내부 InlineShape을 가져옵니다.

네임스페이스:  Microsoft.Office.Tools.Word
어셈블리:  Microsoft.Office.Tools.Word(Microsoft.Office.Tools.Word.dll)

구문

‘선언
Function GetInlineShapeForControl ( _
    control As Control _
) As InlineShape
InlineShape GetInlineShapeForControl(
    Control control
)

매개 변수

반환 값

형식: Microsoft.Office.Interop.Word.InlineShape
지정된 컨트롤에 대한 내부 InlineShape입니다.

설명

컨트롤의 줄 바꿈 스타일이 텍스트 줄 안으로 설정되어 있지 않으면 GetInlineShapeForControl 메서드에서 nullNull 참조(Visual Basic의 경우 Nothing)을 반환합니다.

예제

다음 코드 예제에서는 줄 바꿈 스타일이 텍스트 줄 안이 되도록 Button을 문서에 추가합니다.그러면 코드가 GetInlineShapeForControl 메서드를 호출하여 컨트롤의 내부 InlineShape에서 컨트롤의 위치를 가져옵니다.

Private Sub WordGetInlineShape()
    Dim testButton As Microsoft.Office.Tools.Word.Controls.Button = _
        Me.Controls.AddButton(Me.Paragraphs(1).Range, 50, 25, "testButton")

    Dim buttonShape As Microsoft.Office.Interop.Word.InlineShape = _
            Me.Controls.GetInlineShapeForControl(testButton)

    If buttonShape IsNot Nothing Then
        MessageBox.Show("The following properties can be cached in the" & _
            vbCrLf & "document to enable you to recreate the control:" _
            & vbCrLf & vbCrLf & "Range: position " & _
            buttonShape.Range.Start.ToString _
            & " through " & buttonShape.Range.End.ToString _
            & vbCrLf & "Width: " & buttonShape.Width.ToString _
            & vbCrLf & "Height: " & buttonShape.Height.ToString)
    End If
End Sub
private void WordGetInlineShape()
{
    Microsoft.Office.Tools.Word.Controls.Button testButton =
        this.Controls.AddButton(this.Paragraphs[1].Range, 50, 25,
        "testButton");

    Microsoft.Office.Interop.Word.InlineShape buttonShape =
        this.Controls.GetInlineShapeForControl(testButton);

    if (buttonShape != null)
    {
        MessageBox.Show("The following properties can be cached in the" +
            "\n" + "document to enable you to recreate the control:"
            + "\n\n" + "Range: position " + buttonShape.Range.Start.
            ToString() + "through " + buttonShape.Range.End.ToString()
            + "\n" + "Width: " + buttonShape.Width.ToString() + "\n" +
            "Height: " + buttonShape.Height.ToString());
    }
}

.NET Framework 보안

  • 직접 실행 호출자의 경우 완전히 신뢰합니다. 이 멤버는 부분적으로 신뢰할 수 있는 코드에서 사용할 수 없습니다. 자세한 내용은 부분 신뢰 코드에서 라이브러리 사용을 참조하십시오.

참고 항목

참조

ControlCollection 인터페이스

Microsoft.Office.Tools.Word 네임스페이스