' This example is written in Access. ' The AddRect button adds and draws a rectangle ' picPanWalk - hold down button 1 and move to pan the drawing ' button 2 to walk around the drawing ' picSpin - button 1 to spin, button 2 to zoom in/out, ' double click for full view ' Option Compare Database Option Explicit Dim AnchorX As Integer Dim AnchorY As Integer Dim PerspOn As Boolean Private Type Point3D x As Double y As Double z As Double End Type Private FracY As Double Private Sub AddRect_Click() Mzk.gRect 0, 0, 0, 10, 20 Mzk.gViewFull 1 End Sub Private Sub picPanWalk_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single) If Button = 1 Or Button = 2 Then AnchorX = x AnchorY = y End If End Sub Private Sub picPanWalk_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single) Dim dX As Integer, dY As Integer Dim Rotation As Double, Tip As Double Dim FracX As Double, FracY As Double If Button = 1 And Shift = 0 Then dX = x - AnchorX dY = y - AnchorY If dX <> 0 Or dY <> 0 Then If PerspOn = True Then FracX = -dX / 800 FracY = dY / 800 Else FracX = -dX / 3000 FracY = dY / 3000 End If Mzk.gViewPanEyeAndTarget FracX, FracY Mzk.gViewRepaint AnchorX = x AnchorY = y End If ElseIf Button = 2 Then dX = x - AnchorX dY = y - AnchorY If dX <> 0 Or dY <> 0 Then FracX = -dX / 2000 FracY = -dY / 2000 Mzk.gViewWalkEyeAndTarget FracY Mzk.gViewSpinAboutEye FracX, 0, 0 Mzk.gViewRepaint AnchorX = x AnchorY = y End If End If End Sub Private Sub picSpin_DblClick(Cancel As Integer) Mzk.gViewFull 1 End Sub Private Sub picSpin_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single) If Button = 1 Or Button = 2 Then AnchorX = x AnchorY = y End If End Sub Private Sub picSpin_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single) Dim dX As Integer, dY As Integer Dim Rotation As Double, Tip As Double If Button = 1 Then dX = x - AnchorX dY = y - AnchorY If dX <> 0 Or dY <> 0 Then Rotation = -dX / 1000 Tip = dY / 1000 Mzk.gViewSpinAboutTarget Rotation, Tip, 0# Mzk.gViewRepaint AnchorX = x AnchorY = y End If ElseIf Button = 2 Then dX = x - AnchorX dY = y - AnchorY If dX <> 0 Or dY <> 0 Then FracY = -dY / 2000 Mzk.gViewMoveEyeToTarget FracY Mzk.gViewRepaint AnchorX = x AnchorY = y End If End If End Sub Private Sub Form_Load() ' set up the application's units to metres and radians Mzk.gUnitsSet UNITS_DISTANCE, UNIT_METRES Mzk.gUnitsSet UNITS_ANGLE, UNIT_RADIANS ' set up the view PerspOn = True ' set to perspective view Mzk.gViewSetProjection PERS_VIEW Mzk.gViewSetAngles -45, 20, 0# ' view from bottom right corner End Sub Private Sub Exit_Click() On Error GoTo Err_Exit_Click DoCmd.Close Exit_Exit_Click: Exit Sub Err_Exit_Click: MsgBox Err.Description Resume Exit_Exit_Click End Sub