EndObject Method

This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.

Ends the drawing sequence for the specified ChChartDraw object.

expression.EndObject

expression   Required. An expression that returns a ChChartDraw object.

Example

This example uses the BeforeRender event to cancel drawing the gridlines and plot area of the first chart in Chartspace1. The AfterRender event then replaces the plot area with an ellipse that is drawn after the chart is rendered.

  Private Sub ChartSpace1_AfterRender(drawObject, chartObject)

    Dim chConstants

    Set chConstants = ChartSpace1.Constants

    ' Check to see if the chart has been rendered.
    If TypeName(chartObject) = "ChChart" Then

        ' The next three lines of code set the interior
        ' and border properties of the ellipse.
        drawObject.Interior.SetPresetGradient _
               chConstants.chGradientHorizontal, _
               chConstants.chGradientVariantStart, _
               Int((24 - 1 + 1) * Rnd + 1)
        drawObject.Border.Weight = 1
        drawObject.Border.Color = "black"

        ' Begin the drawing object.
        drawObject.BeginObject 1

        ' Draw the ellipse.
        drawObject.DrawEllipse chartObject.Left, chartObject.Bottom, _
                               chartObject.Right, chartObject.Top

        drawObject.EndObject

  End If

End Sub

Private Sub ChartSpace1_BeforeRender(chartObject, Cancel)

    Select Case TypeName(chartObject)

        Case "ChGridlines"

            ' Cancel the drawing of the gridlines.
            Cancel.Value = True

        Case "ChPlotArea"

            ' Cancel the drawing of the plot area.
            Cancel.Value = True

    End Select

End Sub