HandsOn Writing the Form BeforeRender Event Procedure

1. In the Visual Basic Editor window, double-click Form_Sales Analysis Subform 2.

2. The Code window shows the Form_AfterLayout event procedure you prepared in Hands-On 24-23. Enter the following Form_BeforeRender event procedure below the last procedure code.

Private Sub Form_BeforeRender(ByVal drawObject As Object, _

ByVal chartObject As Object, _ ByVal Cancel As Object)

If TypeName(chartObject) = " ChLegendEntry " Then drawObject.Border.Color = "red" drawObject.DrawEllipse chartObject.Left, _ chartObject.Bottom, _ chartObject.Right, _ chartObject.Top

End If

If TypeName(chartObject) = "ChGridlines" Then

Cancel.Value = True End If

End Sub

3. Switch to the Sales Analysis Subform 2 form and choose View |

PivotChart View. When the form opens you should see the PivotChart formatted as shown in Figure 24-3.

Figure 24-3: This PivotChart view has been altered in the BeforeRender event (see Hands-On 24-24).

Part IV

0 0

Post a comment