Using a PanWindow (Visual J++)

1. Start Visual J++ 6.0.

2.  Add the LEAD Main Control to your project.

On the Tools pull-down menu, use the Customize Toolbox option, chose the ActiveX Controls tab 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 a ChechBox to the form and set the Name and Text properties as follows:

Name

Text

checkBox1

Pan Window

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

Name

Text

PanWindow

Show Pan Window

6.  Code the Form1 constructor as follows:

public Form1()

{

   // Required for Visual J++ Form Designer support

   initForm();

 

   // TODO: Add any constructor code after initForm call

 

   // change the path and filename to something present on your system.

   LEAD1.Load( "v:\\images\\eagle.cmp", (short) 0, (short) 0, (short) 1 );

}

7. Code the PanWindow_click() event as follows:

private void PanWindow_click(Object source, Event e)
{
   // set the location of the PanWindow
   LEAD1.setPanWinX( 100 );
   LEAD1.setPanWinY(100 );

   // set the size of the PanWindow
   // requested width
   LEAD1.setPanWinWidth( 150 );

   // requested height
   LEAD1.setPanWinHeight( 200 );

   // use the icon already being used for LEAD1LEAD1.set
   Icon icon = new Icon( "f:\\point04.ico" );
   LEAD1.setPanWinIcon( icon );

   // set custom pointer
   LEAD1.setPanWinPointer( (short) 99 );

   // use an ICO file present on your system
   LEAD1.setPanWinCursor( icon );
   LEAD1.setPanWinTitle( "PanWindow" );
   LEAD1.setPanWinRectColor( new Color( 0, 0, 255 ) );
   LEAD1.setPanWinSysMenu( true );

   // use the settings for LEAD1LEAD1.set
   LEAD1.setPanWinPaintPalette( LEAD1.getPaintPalette() );
   LEAD1.setPanWinBitonalScaling( LEAD1.getBitonalScaling() );
   LEAD1.setPanWinPaintDither( LEAD1.getPaintDither() );

   //show the Pan Window
   LEAD1.ShowPanWin( true);

   checkBox1.setChecked( true );
}

8.  Code the LEAD1_panWin event as follows:

private void LEAD1_panWin(Object source, LTOCXU.LEAD.PanWinEvent e)
{
   if( e.iFlag == LTOCXU.PanWinFlagConstants.PANWIN_DESTROYED )
      checkBox1.setChecked( false );  // indicate no more Pan Window
}

9. Run your program to test it.