DrawRectangle Method

Microsoft Office Web Components Visual Basic

expression.DrawRectangle(Left, Top, Right, Bottom)

expression    Required. An expression that returns a ChChartDraw object.

Left   Required Long. Pixel coordinate of the left edge of the rectangle.

Top   Required Long. Pixel coordinate of the top edge of the rectangle.

Right   Required Long. Pixel coordinate of the right edge of the rectangle.

Bottom   Required Long. Pixel coordinate of the bottom edge of the rectangle.

Example

This example uses the AfterRender event to draw rectangles as a substitute for the legend entries in the first chart of Chartspace1.

Sub ChartSpace1_AfterRender(drawObject, chartObject)

    Dim chConstants

    Set chConstants = ChartSpace1.Constants

    If TypeName(chartObject) = "ChLegendEntry" Then

        ' Set the interior of the rectangle to a preset texture.
        ' You could substitute a URL to a custom graphic
        ' for the texture.
        drawObject.Interior.SetTextured chConstants.chTextureSand

        ' Begin drawing the rectangle.
        drawObject.BeginObject 1

        ' Draw the rectangle.
        drawObject.DrawRectangle chartObject.Left, chartObject.Top, _
                                 chartObject.Right, chartObject.Bottom

        drawObject.EndObject

    End If

End Sub