當(dāng)指定的數(shù)據(jù)透視圖視圖中任意對象被提交之前,該事件會發(fā)生。
Private Sub Form_BeforeRender(ByVal drawObject As Object, ByVal chartObject As Object, ByVal Cancel As Object)
drawObject 對ChChartDraw 對象的引用。請使用返回對象的 DrawType 屬性來判斷將發(fā)生什么類型的重畫。
chartObject 即將提交的對象。使用 TypeName 函數(shù)確定對象的類型。
Cancel 將該對象的 Value 屬性設(shè)為 True 可取消“數(shù)據(jù)透視圖視圖”對象的提交。
下面的示例顯示了捕獲 BeforeRender 事件的子例程的語法。
Private Sub Form_BeforeRender( _
ByVal drawObject As Object, _
ByVal chartObject As Object, _
ByVal Cancel As Object)
Dim intResponse As Integer
Dim strPrompt As String
strPrompt = "Cancel render of current object?"
intResponse = MsgBox(strPrompt, vbYesNo)
If intResponse = vbYes Then
Cancel.Value = True
Else
Cancel.Value = False
End If
End Sub