本文為機器翻譯文章。如需檢視英文版,請選取 [原文] 核取方塊。您也可以將滑鼠指標移到文字上,即可在快顯視窗顯示英文原文。
譯文
原文

Button.CopyPicture 方法 (XlPictureAppearance, XlCopyPictureFormat)

 

Button 以圖片形式複製到剪貼簿中。

命名空間:   Microsoft.Office.Tools.Excel.Controls
組件:  Microsoft.Office.Tools.Excel.v4.0.Utilities (在 Microsoft.Office.Tools.Excel.v4.0.Utilities.dll 中)

public object CopyPicture(
	XlPictureAppearance Appearance,
	XlCopyPictureFormat Format
)

參數

Appearance

指定應如何複製圖片。

Format

圖片的格式。  接受 xlPicture 的值。  

傳回值

Type: System.Object

如果複製成功,則為 true,否則為 false

For information on optional parameters, see Office 方案中的選擇性參數.

The following code example demonstrates a Button control that copies itself to the Clipboard when the user clicks it.  The Click event handler of the button calls the CopyPicture method to copy the button to the Clipboard as a bitmap.  

This example is for a document-level customization.

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);
}
回到頁首
顯示: