Using a PanWindow (Visual Basic)

1. Start Visual Basic. Select Standard EXE and click Open.

2.  Add the LEAD Main Control to your project.

For VB4: On the Tools pull-down menu, use the Custom Controls option, and select the LEAD Main ActiveX Control (16).

For VB5: On the Project pull-down menu, use the Components option, and select the LEAD Main ActiveX Control (16).

3.  Select the LEAD Main Control and add the control to your main form. Size and position the control as you want it to appear at run time. You may want to size it small so you can observe the changes that occur as you move the PanWin rect

4. Add an Option Button to the form and set the Name and Caption properties as follows:

Name

Caption

Check1

Pan Window

5. Add a Command Button to the form and set the Name and Caption properties as follows:

Name

Caption

PanWindow

Show Pan Window

6.  Code the Form_Load procedure as follows:

Private Sub Form_Load()

'change the path and filename to something present on your system.
   LEAD1.Load "v:\images\eagle.cmp", 0, 0, 1
End Sub

7. Code the PanWindow_Click() procedure as follows:

Private Sub PanWindow_Click()
With LEAD1
       'set the location of the PanWindow
      .PanWinX = 100
      .PanWinY = 100
       'set the size of the PanWindow
       'requested width
      .PanWinWidth = 150
       'requested height
      .PanWinHeight = 200 
       'use the icon already being used for LEAD1.
      .PanWinIcon = Icon
       'set custom pointer
      .PanWinPointer = 99 
       'use an ICO file present on your system
      .PanWinCursor = LoadPicture("d:\temp\snow.ico")
      .PanWinTitle = "PanWindow"
      .PanWinRectColor = RGB(0, 0, 255)
      .PanWinSysMenu = True
       'use the settings for LEAD1.
      .PanWinPaintPalette = .PaintPalette
      .PanWinBitonalScaling = .BitonalScaling
      .PanWinPaintScaling = .PaintScaling
      .PanWinPaintDither = .PaintDither
       'show the Pan Window
      .ShowPanWin True 
   End With
Check1.Value = 1

End Sub

8.  Code the LEAD1_PanWin procedure as follows:

Private Sub LEAD1_PanWin(ByVal hPanWin As Stdole.OLE_HANDLE, ByVal iFlag As Integer)
    If (iFlag = PANWIN_DESTROYED) Then
        Check1.Value = False 'indicate no more Pan Window
    End If
End Sub.

9. Run your program to test it.