将图表作为图片复制到剪贴板。
命名空间:  Microsoft.Office.Tools.Excel
程序集:  Microsoft.Office.Tools.Excel(在 Microsoft.Office.Tools.Excel.dll 中)
语法
声明
Sub CopyPicture ( _
    Appearance As XlPictureAppearance, _
    Format As XlCopyPictureFormat, _
    Size As XlPictureAppearance _
)
void CopyPicture(
    XlPictureAppearance Appearance,
    XlCopyPictureFormat Format,
    XlPictureAppearance Size
)
参数
- Appearance
 类型:Microsoft.Office.Interop.Excel.XlPictureAppearance
 XlPictureAppearance.指定复制图片的方法。
- Format
 类型:Microsoft.Office.Interop.Excel.XlCopyPictureFormat
 XlCopyPictureFormat.该图片的格式。
- Size
 类型:Microsoft.Office.Interop.Excel.XlPictureAppearance
 XlPictureAppearance.对象为图表工作表上的图表(未嵌入在工作表上)上时复制的图片的大小。
备注
可选参数
有关可选参数的信息,请参见Office 解决方案中的可选参数。
示例
下面的代码示例创建一个 Chart,然后使用 CopyPicture 方法将图表作为位图复制到剪贴板。
Private Sub CopyChartAsBitmap()
    Me.Range("A1", "A5").Value2 = 22
    Me.Range("B1", "B5").Value2 = 55
    Dim Chart1 As Microsoft.Office.Tools.Excel.Chart = _
        Me.Controls.AddChart(Me.Range("D2", "H12"), "Chart1")
    Chart1.SetSourceData(Me.Range("A1", "B5"), Excel.XlRowCol.xlColumns)
    Chart1.ChartType = Excel.XlChartType.xl3DColumn
    Chart1.CopyPicture(Excel.XlPictureAppearance.xlScreen, _
        Excel.XlCopyPictureFormat.xlBitmap, _
        Excel.XlPictureAppearance.xlScreen)
End Sub
private void CopyChartAsBitmap()
{
    this.Range["A1", "A5"].Value2 = 22;
    this.Range["B1", "B5"].Value2 = 55;
    Microsoft.Office.Tools.Excel.Chart chart1 =
        this.Controls.AddChart(this.Range["D2", "H12"], 
        "chart1");
    chart1.SetSourceData(this.Range["A1", "B5"], 
        Excel.XlRowCol.xlColumns);
    chart1.ChartType = Excel.XlChartType.xl3DColumn;
    chart1.CopyPicture(Excel.XlPictureAppearance.xlScreen,
        Excel.XlCopyPictureFormat.xlBitmap, 
        Excel.XlPictureAppearance.xlScreen);
}
.NET Framework 安全性
- 对直接调用方的完全信任。此成员不能由部分信任的代码使用。有关更多信息,请参见通过部分受信任的代码使用库。