다음을 통해 공유


ChartSheetBase.ChartStyle Property

Definition

Gets or sets the style of the chart.

public:
 property System::Object ^ ChartStyle { System::Object ^ get(); void set(System::Object ^ value); };
public object ChartStyle { get; set; }
member this.ChartStyle : obj with get, set
Public Property ChartStyle As Object

Property Value

An integer from 1 through 48 that represents the style of the chart.

Examples

The following code example specifies the colors of the walls and floor of an existing 3-D chart sheet and sets the chart style to style 4. To run this code example, the workbook must contain a chart sheet called Chart1 of a 3-D type.

private void SetChartSheetDesign()
{
    // Add a new chart and populate source data
    Microsoft.Office.Tools.Excel.ChartSheet myChartSheet =
        Globals.Chart1.Base;

    myChartSheet.BackWall.Format.Fill.ForeColor.RGB =
        System.Drawing.Color.LightGray.ToArgb();
    myChartSheet.SideWall.Format.Fill.ForeColor.RGB =
        System.Drawing.Color.LightGray.ToArgb();
    myChartSheet.Floor.Format.Fill.ForeColor.RGB =
        System.Drawing.Color.Gray.ToArgb();

    myChartSheet.ChartStyle = 4;
}
Private Sub SetChartSheetDesign()
    ' Add a new chart and populate source data
    Dim myChartSheet As Microsoft.Office.Tools.Excel.ChartSheet = _
        Globals.Chart1.Base

    myChartSheet.BackWall.Format.Fill.ForeColor.RGB = _
        System.Drawing.Color.LightGray.ToArgb()
    myChartSheet.SideWall.Format.Fill.ForeColor.RGB = _
        System.Drawing.Color.LightGray.ToArgb()
    myChartSheet.Floor.Format.Fill.ForeColor.RGB = _
        System.Drawing.Color.Gray.ToArgb()

    myChartSheet.ChartStyle = 4
End Sub

Remarks

The values of the ChartStyle property correspond to the available options on the Chart Styles group on the Design tab on the Ribbon. The Design tab is available when you select a chart.

Applies to