Using a PanWindow (Delphi 4.0)

1.

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

2.

Replace the Main Form Create Procedure to the follwing.

procedure TForm1.FormCreate(Sender: TObject);
begin
  //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 := 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;
end;

3.

Add a RadioButton to the form and set the Name and Caption properties as follows:

 

Name

Caption

 

Check1

Pan Window

4.

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

 

Name

Caption

 

PanWindow

Show Pan Window

5.

Code the PanWindow click’s procedure as the following:

procedure TForm1.PanWindowClick(Sender: TObject);
var
   sRet: smallint;
begin
   With LEADRasterView1 do
   begin
      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;

      LEADRasterView1.PanWinPointer:= 12;
      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, sRet);
   end;
   Check1.Checked := True;
end;

6.

Code the LEADRasterView1 PanWin event procedure as follows:

procedure TForm1.LEADRasterView1PanWin (Sender: TObject; hPanWin: Integer;
  iFlag: Smallint);
begin
   if (iFlag = PANWIN_DESTROYED) then
      Check1.Checked := False ;//indicate no more Pan Window
end;

7.

Run your program to test it.