Using a PanWindow (C++ Builder 3.0)

1. Start C++ Builder 3.0.

2. On the C++ Builder toolbar, click the ActiveX tab. If you have used a LEAD ActiveX control before, the icon appears on the toolbar. Otherwise, add the LEAD control as follows:

a. On the Component, and choose Import ActiveX Control.

b. In the Import ActiveX dialog, highlight the LEAD Main Control (12). Change the Class name to TLEAD. Click Install.

c. If you have previously added a LEAD control, you will get a Confirm dialog that tells you that the xxx_TLB.cpp file already exists, and asks if you want to replace it. Click Yes.

d. In the Install dialog, click OK.

e. In the Confirm dialog, click Yes.

f. The Compiling Package DCLUSR35 dialog will appear. You may elect not to have this dialog appear again. Click Yes.

g. The Compiling dialog will appear.

f. After compiling has completed, the Information dialog will appear. Click OK.

g. At this point you will be presented with the DCLUSR35.cpp window, with USEUNIT and USERES lines for each LEAD control installed in the project. Save and close DLCUSR35.bpk. Do not save Unit 1, Project 1 or ProjectGroup 1.

3. In the File menu, choose New Application.

4. Select the LEAD control on the ActiveX toolbar. Size and position the control as you want it to appear at run time, and change the name of the control to LEAD1.

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 RadioButton from the Standard toolbar to the form and name it as follows:

Name

Caption

RadioButton1

Pan Window

7. Code the PanWinClick procedure as follows:

void __fastcall TForm1::PanWinClick(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 = 12;

     LEAD1->PanWinTitle = StringToOleStr("PanWindow");
     LEAD1->PanWinRectColor = clBlue;
     LEAD1->PanWinSysMenu = True;
     /*use the settings for LEAD1*/
     LEAD1->PanWinPaintPalette = LEAD1->PaintPalette;
     LEAD1->PanWinBitonalScaling = LEAD1->BitonalScaling;
     LEAD1->PanWinPaintDither = LEAD1->PaintDither;
     LEAD1->ShowPanWin(True);

    RadioButton1->Checked = True;
}

10. 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 (StringToOleStr("e:\\ltwin12x\\images\\image1.cmp"), 0, 0, 1);
}

11. Code the Lead1PanWin procedure as follows:

void __fastcall TForm1::LEAD1PanWin(TObject *Sender, OLE_HANDLE hPanWin,
      short iFlag)
{
    if (iFlag == PANWIN_DESTROYED)
        RadioButton1->Checked = False;
}

12. Run your program to test it.