将 NamedRange 控件作为图片复制到剪贴板。
命名空间:  Microsoft.Office.Tools.Excel
程序集:  Microsoft.Office.Tools.Excel(在 Microsoft.Office.Tools.Excel.dll 中)
语法
声明
Function CopyPicture ( _
    Appearance As XlPictureAppearance, _
    Format As XlCopyPictureFormat _
) As Object
Object CopyPicture(
    XlPictureAppearance Appearance,
    XlCopyPictureFormat Format
)
参数
- Appearance
 类型:Microsoft.Office.Interop.Excel.XlPictureAppearance
 指定复制图片的方法。
 可以是下列 XlPictureAppearance 常数之一:
 xlPrinter
 xlScreen
- Format
 类型:Microsoft.Office.Interop.Excel.XlCopyPictureFormat
 该图片的格式。
 可以是下列 XlCopyPictureFormat 常数之一:
 xlBitmap
 xlPicture
返回值
备注
可选参数
有关可选参数的信息,请参见Office 解决方案中的可选参数。
示例
下面的代码示例创建一个 NamedRange 并用单词 Smith 填充它。 然后,它使用 CopyPicture 方法将 NamedRange 作为位图复制到剪贴板。
此示例针对的是文档级自定义项。
Private copyBitmapRange As Microsoft.Office.Tools.Excel.NamedRange
Private Sub CopyAsBitmap()
    copyBitmapRange = Me.Controls.AddNamedRange( _
        Me.Range("C3"), "copyBitmapRange")
    Me.copyBitmapRange.Value2 = "Smith"
    Me.copyBitmapRange.CopyPicture( _
        Excel.XlPictureAppearance.xlScreen, _
        Excel.XlCopyPictureFormat.xlBitmap)
End Sub
Microsoft.Office.Tools.Excel.NamedRange copyBitmapRange;
private void CopyAsBitmap()
{
    copyBitmapRange = this.Controls.AddNamedRange(
        this.Range["C3", missing], "copyBitmapRange");
    this.copyBitmapRange.Value2 = "Smith";
    this.copyBitmapRange.CopyPicture(
        Excel.XlPictureAppearance.xlScreen,
        Excel.XlCopyPictureFormat.xlBitmap);
}
.NET Framework 安全性
- 对直接调用方的完全信任。此成员不能由部分信任的代码使用。有关更多信息,请参见通过部分受信任的代码使用库。