Using a PanWindow (C++ Builder 6.0)

1.

Start with the project that you created in Loading and Displaying an Image.

2.

Replace FormCreate Procedure to be as the following.

void __fastcall TForm1::FormCreate(TObject *Sender) 
{
   //Set defaults for displaying the image
   //These are all persistent properties that can be set in the properties box->
   LEADRasterView1->Appearance = RASTERVIEW_APPEARANCE_FLAT; 
   LEADRasterView1->BorderStyle = 1; 
   LEADRasterView1->BackColor = (TColor)RGB(255, 255, 125); 
   LEADRasterView1->PaintDither = PAINTDITHER_DIFFUSION; 
   LEADRasterView1->PaintPalette = PAINTPALETTE_AUTO; 
   LEADRasterView1->AutoRepaint = True; 
   LEADRasterView1->AutoSize = False; 
   LEADRasterView1->AutoSetRects = True; 
   LEADRasterView1->PaintSizeMode = PAINTSIZEMODE_NORMAL; 
}

3.

Add a Check Box control to your form and name it as follows:

 

Name

Caption

 

chkPanWin

Pan Window

4.

Add a button to your form and name it as follows:

 

Name

Caption

 

btnPanWindow

Show Pan Window

5.

Code the btnPanWindow click’s procedure as the following:

void __fastcall TForm1::btnPanWindowClick(TObject *Sender) 
{
   LEADRasterView1->BackErase = False; 
   //set the location of the PanWindow
   LEADRasterView1->PanWinX = 100;
   LEADRasterView1->PanWinY = 100;
   //set the size of the PanWindow
   //requested width
   LEADRasterView1->PanWinWidth = 150;
   //requested height
   LEADRasterView1->PanWinHeight = 200;

   LEADRasterView1->PanWinPointer = 12;
   LEADRasterView1->PanWinTitle = "PanWindow";
   LEADRasterView1->PanWinRectColor = (TColor)RGB(0, 0, 255);
   LEADRasterView1->PanWinSysMenu = True;
   //use the settings for LEADRasterView1.
   LEADRasterView1->PanWinPaintPalette = LEADRasterView1->PaintPalette;
   LEADRasterView1->PanWinBitonalScaling = LEADRasterView1->BitonalScaling;
   LEADRasterView1->PanWinPaintScaling = LEADRasterView1->PaintScaling;
   LEADRasterView1->PanWinPaintDither = LEADRasterView1->PaintDither;
   //show the Pan Window
   LEADRasterView1->ShowPanWin (true);
   chkPanWin->Checked= true;

}

6.

Code the LEADRasterView1 OnPanWin event procedure as follows:

void __fastcall TForm1::LEADRasterView1PanWin(TObject *Sender, 
      long hPanWin, short iFlag) 
{
   if (iFlag == PANWIN_DESTROYED) 
      chkPanWin->Checked= false ;//indicate no more Pan Window
}

7.

Run your program to test it.