Button.CopyPicture(XlPictureAppearance, XlCopyPictureFormat) Methode

Definition

Kopiert Button als Bild in die Zwischenablage.

public object CopyPicture (Microsoft.Office.Interop.Excel.XlPictureAppearance Appearance, Microsoft.Office.Interop.Excel.XlCopyPictureFormat Format);

Parameter

Appearance
XlPictureAppearance

Gibt an, wie das Bild kopiert werden soll.

Format
XlCopyPictureFormat

Das Format des Bilds. Nimmt den Wert xlPicture an.

Gibt zurück

Object

true, wenn der Kopiervorgang erfolgreich war; andernfalls false.

Beispiele

Im folgenden Codebeispiel wird ein-Steuerelement veranschaulicht Button , das sich in die Zwischenablage kopiert, wenn der Benutzer darauf klickt. Der- Click Ereignishandler der Schaltfläche ruft die- CopyPicture Methode auf, um die Schaltfläche als Bitmap in die Zwischenablage zu kopieren.

Dieses Beispiel gilt für eine Anpassung auf Dokument Ebene.

private void CopyControlAsPicture()
{
    Microsoft.Office.Tools.Excel.Controls.Button copyButton =
        this.Controls.AddButton(this.Range["B2", "D3"],
        "copyButton");

    copyButton.Text = "Click to copy this control";
    copyButton.Click += new EventHandler(copyButtonPicture_Click);
}

void copyButtonPicture_Click(object sender, EventArgs e)
{
    Microsoft.Office.Tools.Excel.Controls.Button clickedButton =
        (Microsoft.Office.Tools.Excel.Controls.Button)sender;

    clickedButton.CopyPicture(
        Excel.XlPictureAppearance.xlScreen,
        Excel.XlCopyPictureFormat.xlBitmap);
}
Private Sub CopyControlAsPicture()
    Dim CopyButton As Microsoft.Office.Tools.Excel.Controls.Button = _
        Me.Controls.AddButton(Me.Range("B2", "D3"), "CopyButton")

    CopyButton.Text = "Click to copy this control"
    AddHandler CopyButton.Click, AddressOf copyButtonPicture_Click
End Sub


Private Sub CopyButtonPicture_Click(ByVal sender As Object, ByVal e As EventArgs)
    Dim ClickedButton As Microsoft.Office.Tools.Excel.Controls.Button = _
        CType(sender, Microsoft.Office.Tools.Excel.Controls.Button)

    ClickedButton.CopyPicture(Excel.XlPictureAppearance.xlScreen, _
        Excel.XlCopyPictureFormat.xlBitmap)

End Sub

Hinweise

Optionale Parameter

Weitere Informationen zu optionalen Parametern finden Sie unter optionale Parameter in Office-Projektmappen.

Gilt für