Button.CopyPicture-Methode

Kopiert Button als Bild in die Zwischenablage.

Namespace:  Microsoft.Office.Tools.Excel.Controls
Assembly:  Microsoft.Office.Tools.Excel.v4.0.Utilities (in Microsoft.Office.Tools.Excel.v4.0.Utilities.dll)

Syntax

'Declaration
Public Function CopyPicture ( _
    Appearance As XlPictureAppearance, _
    Format As XlCopyPictureFormat _
) As Object
public Object CopyPicture(
    XlPictureAppearance Appearance,
    XlCopyPictureFormat Format
)

Parameter

Rückgabewert

Typ: System.Object
true , wenn der Kopiervorgang erfolgreich war; andernfalls false.

Hinweise

Optionale Parameter

Informationen zu optionalen Parametern finden Sie unter Optionale Parameter in Office-Lösungen.

Beispiele

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

Dieses Beispiel bezieht sich auf eine Anpassung auf Dokumentebene.

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
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);
}

.NET Framework-Sicherheit

Siehe auch

Referenz

Button Klasse

Microsoft.Office.Tools.Excel.Controls-Namespace