Using a PanWindow (Delphi)
1. |
Start Delphi. |
2. |
In the File menu, choose New Application. |
3. |
On the Delphi toolbar, click the LEADTOOLS tab. If you have used a LEAD VCL control before, the icon appears on the toolbar. Otherwise, refer to Installing VCL before continuing with this tutorial. |
4. |
|
5. |
Add a command button from the Standard toolbar to your form and name it as follows: |
|
Name |
Caption |
|
PanWindow |
Show Pan Window |
6. |
Add a Check box from the Standard toolbar to the form and name it as follows: |
Name |
Caption |
Check1 |
Pan Window |
7. |
Select the Unit1 tab in the Unit1.pas window. Add LEADUNT to the Uses Section in the Interface part of the unit1. |
8. |
Double click on the Show Pan Window button and code the PanWindowClick procedure as follows: |
procedure TForm1.PanWindowClick(Sender: TObject);
begin
with LEAD1 do
begin
{set the location of the PanWindow}
PanWinX := 100;
PanWinY := 100;
{set the size of the PanWindow}
PanWinWidth := 150;
PanWinHeight := 200;
{set the type of mouse pointer}
PanWinPointer := 12;
PanWinTitle := 'PanWindow';
PanWinRectColor := RGB(0, 0, 255);
PanWinSysMenu := True;
{use the settings for LEAD1}
PanWinPaintPalette := PaintPalette;
PanWinBitonalScaling := BitonalScaling;
PanWinPaintDither := PaintDither;
PanWinPaintScaling := PaintScaling;
ShowPanWin(True);
end;
Check1.Checked := True;
end;
9. |
Code the FormActivate procedure as follows: |
procedure TForm1.FormActivate(Sender: TObject);
begin
{set the path and name to an image file on your system}
LEAD1.Load (' c:\lead\images\scn1.tif ', 0, 0, 1);
end;
10. |
Code the Lead1OnPanWin procedure as follows: |
procedure TForm1.Lead1PanWin(Sender: TObject; hPanWin: Cardinal;
iFlag: Integer);
begin
if (iFlag = PANWIN_DESTROYED) Then
Check1.Checked := False;
end;
11. |
Run your program to test it. |