Using a PanWindow (Visual Basic)

1.

Start Visual Basic. Select Standard EXE and click Open.

2.

Add the LEAD Raster View Control and LEAD Raster Variant Object Library to your project.

 

On the Project pull-down menu, use the Components option, and select the LEAD Raster View Control (14.5).

 

On the Project pull-down menu, use the References option, and select the LEAD Raster Variant Object Library (14.5).

3.

Select the LEAD RasterView 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.

Add the LEAD RasterIO Object to your project.

 

On the Project pull-down menu, use the References option, and select the LEAD RasterIO Object Library (14.5).

7.

Code the Form_Load procedure as follows:

Private Sub Form_Load()
    Dim RasterIO As New LEADRasterIO
    'change the path and filename to something present on your system.
    RasterIO.Load LEADRasterView1.Raster, "d:\temp\24bit.bmp", 0, 0, 1
End Sub

8.

Code the PanWindow_Click() procedure as follows:

Private Sub PanWindow_Click()
   With LEADRasterView1
      .BackErase = False
       '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 LEADRasterView1.
      .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 LEADRasterView1.
      .PanWinPaintPalette = .PaintPalette
      .PanWinBitonalScaling = .BitonalScaling
      .PanWinPaintScaling = .PaintScaling
      .PanWinPaintDither = .PaintDither
       'show the Pan Window
      .ShowPanWin True
   End With
   Check1.Value = 1
End Sub

9.

Code the LEADRasterView1_PanWin procedure as follows:

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

10.

Run your program to test it.