KeyPress example for Visual Basic
Note: Also works with Access 95 and 97.
This example demonstrates the KeyPress event.
Private Sub LEADRasterView1_KeyPress(ByVal KeyAscii As Integer)
'This example uses the KeyPress event to implement a custom scale mode.
'There is no particular reason to put this code in this event
'This sample is just here to provide an example of both the Key Press event
'and the scale mode.
If KeyAscii = 67 Then 'Uppercase C
'This example sets an custom scale mode and uses it to crop the
'display. Keep in mind that the actual height and width do not change.
'Only the unit of measure changes.
'Change the scale so that origin is moved one-third right and one-third down
LEADRasterView1.ScaleLeft = -1
LEADRasterView1.ScaleTop = -1
LEADRasterView1.ScaleWidth = 3
LEADRasterView1.ScaleHeight = 3
'Crop the display so that it takes up the middle third of the height and width
LEADRasterView1.DstClipLeft = 0
LEADRasterView1.DstClipTop = 0
LEADRasterView1.DstClipWidth = 1
LEADRasterView1.DstClipHeight = 1
LEADRasterView1.ForceRepaint
End If
End Sub