Using a PanWindow (C++ Builder)
1. |
Start C++ Builder. |
2. |
In the File menu, choose New Application. |
3. |
On the Builder 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 |
PanWin |
Show Pan Window |
6. |
Add a CheckBox from the Standard toolbar to the form and name it as follows: |
Name |
Caption |
Check1 |
Pan Window |
7. |
Code the PanWindowClick procedure as follows: |
void __fastcall TForm1::PanWindowClick(TObject *Sender)
{
//set the location of the PanWindow
Lead1->PanWinX = 100;
Lead1->PanWinY = 100;
//set the size of the PanWindow
Lead1->PanWinWidth = 150;
Lead1->PanWinHeight = 200;
//set the type of mouse pointer
Lead1->PanWinPointer = crHandPoint;
Lead1->PanWinTitle = "PanWindow";
Lead1->PanWinRectColor = (TColor)RGB(0, 0, 255);
Lead1->PanWinSysMenu = True;
//use the settings for LEAD1
Lead1->PanWinPaintPalette = Lead1->PaintPalette;
Lead1->PanWinBitonalScaling = Lead1->BitonalScaling;
Lead1->PanWinPaintDither = Lead1->PaintDither;
Lead1->PanWinPaintScaling = Lead1->PaintScaling;
Lead1->ShowPanWin(True);
Check1->Checked = True;
}
8. |
Code the FormActivate procedure as follows: |
void __fastcall TForm1::FormActivate(TObject *Sender)
{
//set the path and name to an image file on your system
Lead1->Load("c:\\lead\\images\\scn1.tif", 0, 0, 1);
}
9. |
Code the Lead1OnPanWin event as follows: |
void __fastcall TForm1::Lead1PanWin(TObject *Sender, int hPanWin,
int iFlag)
{
if (iFlag == PANWIN_DESTROYED)
Check1->Checked = False;
}
10. |
Build the project and run your program to test it. |