共用方式為


ChartObject 類別

代表報表中的圖表物件。這個類別可以讓您擷取資訊,並設定繼承自 ReportObject 類別的泛用格式選項。

如需這個類型所有成員的清單,請參閱 ChartObject 成員

Object

   ReportObject

      ChartObject

[Visual Basic]

Public Class ChartObject
   Inherits ReportObject

[C#]

public class ChartObject : ReportObject

[C++]

__gc public class ChartObject : public ReportObject

[VJ#]

public class ChartObject extends ReportObject

註解

透過 ReportObjects 集合的 Item 屬性以索引或名稱來擷取 ReportObject 物件,並轉換 ReportObject ChartObject

範例

下列範例會傳回 ChartObject 物件。

[Visual Basic]

Private Function GetChartObject _ 
(ByVal reportObjectName As String) As ChartObject
   Dim chart As ChartObject

   ' 依名稱取得 ReportObject,將之轉換為 ChartObject,
   '  然後將它傳回來。
   If TypeOf _
   (Report.ReportDefinition.ReportObjects. _ 
   Item(reportObjectName)) Is ChartObject Then
      chart = _ 
      Report.ReportDefinition.ReportObjects. _ 
      Item(reportObjectName)
      GetChartObject = chart
   Else : GetChartObject = Nothing
   End If
End Function

[C#]

private ChartObject GetChartObject(string reportObjectName)
{
   ChartObject chart;

   // 依名稱取得 ReportObject,將之轉換為 ChartObject,
   //  然後將它傳回來。
   chart =
   Report.ReportDefinition.ReportObjects[reportObjectName] 
   as ChartObject;
   if (chart != null) return chart;
   else return null;
}

[C++]

ChartObject* GetChartObject(String* reportObjectName)
{
   ChartObject* chart;

   // 依名稱取得 ReportObject,將之轉換為 ChartObject,
   //  然後將它傳回來。
   try
   {
      chart = __try_cast<ChartObject*>
      (Report->ReportDefinition->
      ReportObjects->Item[reportObjectName]);
      return chart;
   }
   catch(System::InvalidCastException*)
   {
      return 0;
   }
}; 

[VJ#]

private ChartObject GetChartObject(String reportObjectName)
{
   ChartObject chart;

   // 依名稱取得 ReportObject,將之轉換為 ChartObject,
   //  然後將它傳回來。
   chart = (ChartObject)
   Report.get_ReportDefinition().get_ReportObjects().get_Item(reportObjectName);
   if (chart != null) return chart;
   else return null;
}

需求

命名空間CrystalDecisions.CrystalReports.Engine

**平台:**Windows 98、Windows NT 4.0、Windows Millennium Edition、Windows 2000

**組件:**CrystalDecisions.Crystalreports.Engine (CrystalDecisions.Crystalreports.Engine.dll)

請參閱

ChartObject 成員 | CrystalDecisions.CrystalReports.Engine 命名空間