KeyCode Property Example

The event procedure in this example makes it possible for the user to rotate the specified chart by using the left and right arrow keys. Note that Charts(0) must refer to either a pie chart or a doughnut chart. Note also that this event procedure is declared as required by Visual Basic. For more information about using event procedures, see Declaring and Using Event Procedures in VBScript.

Private Sub ChartSpace1_KeyDown(ByVal ChartEventInfo As OWC.WCChartEventInfo)
    Select Case ChartEventInfo.KeyCode
        Case 37 'left arrow
            i = -10
        Case 39 'right arrow
            i = 10
    End Select
    ChartSpace1.Charts(0).FirstSliceAngle = _
        ChartSpace1.Charts(0).FirstSliceAngle + i
End Sub