Udostępnij za pośrednictwem


DocumentBase.Background Property

Definition

Gets or sets a Shape that represents the background image for the specified document.

public:
 property Microsoft::Office::Interop::Word::Shape ^ Background { Microsoft::Office::Interop::Word::Shape ^ get(); void set(Microsoft::Office::Interop::Word::Shape ^ value); };
public Microsoft.Office.Interop.Word.Shape Background { get; set; }
member this.Background : Microsoft.Office.Interop.Word.Shape with get, set
Public Property Background As Shape

Property Value

A Shape that represents the background image for the specified document.

Examples

The following code example sets the background of the document to a picture. This example assumes that there is a file named Image.jpg at the root of the C directory. To use this example, run it from the ThisDocument class in a document-level project.

private void DocumentBackground()
{
    this.ActiveWindow.View.Type = Word.WdViewType.wdWebView;
    this.Background.Fill.UserPicture("C:\\Image.jpg");
}
Private Sub DocumentBackground()
    Me.ActiveWindow.View.Type = Word.WdViewType.wdWebView
    Me.Background.Fill.UserPicture("C:\Image.jpg")
End Sub

Remarks

Backgrounds are visible only in Web layout view.

Applies to