Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Скачиваний:
81
Добавлен:
11.05.2015
Размер:
2.11 Mб
Скачать

Crystal ActiveX Controls

ActiveX controls bring more powerful applications to desktops and networks. ActiveX moves beyond applications that produce static documents to a Windows environment that provides active controls, documents, and client applications that can operate and interact not only with each other, but also with network intranets and the global Internet.

ActiveX controls provide plug-in capabilities that let you add application components, and even entire applications, to your own development projects without writing a line of code. Seagate Crystal Reports includes the Crystal ActiveX Control. Use the ActiveX Control to easily add all of the report processing power of Seagate Crystal Reports to your own Visual Basic, Visual C++, Borland C++, Delphi, and other applications.

NOTE: The development tools may refer to an ActiveX Control by any of the following names: OLE Control, OCX Control, Custom Control, or ActiveX Control. As long as the term used refers to a control with an .OCX filename extension, it is synonymous with the term ActiveX Control used here.

NOTE: Seagate Crystal Reports also includes a Visual Basic Custom Control (CRYSTAL.VBX). However, the ActiveX Control is based on more advanced technology and provides more features. You should use the ActiveX Control for development of any new Visual Basic projects. To upgrade an existing project to use the ActiveX Control, see Upgrading from the Crystal Custom Control, Page 110. If, for some reason, you choose to use the VBX in your project rather than the ActiveX Control, the VBX has been fully documented in Developer’s online Help.

The following topics are discussed in this section.

Adding the ActiveX Control to your Project, Page 108

Using the ActiveX Controls, Page 109

Upgrading from the Crystal Custom Control, Page 110

Adding the ActiveX Control to your Project

This section demonstrates how to add the Crystal ActiveX Control to an application project being designed in Visual Basic versions 5.0 and 6.0. If you wish to use the ActiveX Control in a different development environment or a different version of Visual Basic, please refer to the documentation that came with your development tools for information on adding an ActiveX or OLE Control (OCX) to your project.

The Crystal ActiveX Control was installed in the \WINDOWS\SYSTEM directory when you installed Seagate Crystal Reports. You add the ActiveX Control to your Visual Basic project using the COMPONENTS command on the Visual Basic Project menu.

1Open Visual Basic.

2Open the project to which you want to add the ActiveX Control.

Visual Basic Solutions

108

3Choose COMPONENTS from the Project menu. The Components dialog box appears.

If Crystal Report Control appears in the Available Controls list, click the check box next to it, click OK, and skip to Step 6.

If Crystal Report Control does not appear in the Available Controls list, click Browse. The Add ActiveX Control dialog box appears.

NOTE: Crystal Report Control is the name of the Crystal ActiveX Control when it is added to a development project. The term ActiveX Control refers to a type of control, while Crystal Report Control is the name of the ActiveX Control provided by Seagate Crystal Reports.

4Use the controls in the Add ActiveX Control dialog box to locate and select the CRYSTL32.OCX file. This file was installed in your \WINDOWS\SYSTEM directory when you installed Seagate Crystal Reports. Once you locate and select the file, click Open.

5Crystal Report Control will now appear in the Available Controls list box. Click the check box next to the name of the control, and click OK.

Visual Basic adds the Crystal ActiveX Control to your toolbox. The tool looks like this:

6To add the ActiveX Control to a form, double-click the tool in the toolbox and Visual Basic installs it on the active form.

NOTE: For instructions on how to add an ActiveX Control or OLE control to development applications other than Visual Basic, refer to the documentation that came with the development application you are using.

Using the ActiveX Controls

Once you have the ActiveX Control object on your form, you build the connection between your application and Seagate Crystal Reports by setting the object's properties at design time or changing properties at runtime. The ActiveX properties let you specify:

the name of the report you want to print in response to an application event,

the destination for that report (window, file, or printer),

the number of copies you want to print (if your report is going to the printer),

print file information (if your report is going to a file),

preview window sizing and positioning information (if your report is going to a window),

selection formula information (if you want to limit the records in your report),

sorting information, and

other related properties.

Crystal ActiveX Control properties can be changed either at design time or at runtime. Note, however, some properties are available only at runtime. These properties do not appear in the Properties list at design time.

NOTE: For a complete description of each property in the Crystal ActiveX Control, refer to the Crystal ActiveX Control Reference, Volume 3, Chapter 5.

Visual Basic Solutions

109

Changing Properties for the ActiveX Control

1Click the ActiveX control on your form to select it.

2Right-click and choose CRYSTAL PROPERTIES from the shortcut menu. The Property Pages dialog box appears.

3Use the tabs and controls in this dialog box to change the ActiveX Control properties at design time.

NOTE: ActiveX Control properties also appear in the Visual Basic Properties list box. For instructions on using the Properties list box, refer to your Visual Basic documentation.

Changing Properties at Runtime

You can set most of the ActiveX Control properties at runtime by adding simple entries to your procedure code. Runtime property settings replace settings you make via the Properties list at design time.

Use the Action property (Page 994) or the PrintReport method (Page 1119) to actually process the report at runtime. The Action property and the PrintReport method can only be used at runtime, and are the only means by which a report can actually be generated by the ActiveX Control.

For information on how to set ActiveX Control properties at runtime, refer to their syntax by searching for each property by name in the Developer’s online Help. Included are examples of how to set each property at runtime.

Upgrading from the Crystal Custom Control

If you are using the Crystal Custom Control (CRYSTAL.VBX) in a Visual Basic project, you can upgrade your project to use the more powerful Crystal ActiveX control. All previous code and settings will be retained when you upgrade your project.

Normally, Visual Basic versions 4.0 and 5.0 automatically upgrade the control used in your project when you simply open the project in the Visual Basic environment. If Visual Basic does not upgrade your Crystal Custom Control correctly, open the VB.INI file in a text editor, such as Notepad, and verify the following settings exist in the appropriate sections.

For 16-bit environments:

[VBX Conversions16] crystal.vbx={00025600-0000-0000-C000-000000000046}

#5.0#0;c:\windows\system\crystl16.ocx

For 32-bit environments:

[VBX Conversions32] crystal.vbx={00025600-0000-0000-C000-000000000046}

#5.0#0;c:\windows\system\crystl32.ocx

NOTE: The actual path indicated should correspond to the location of the Crystal ActiveX Control. The path on your system may or may not be the same as the path shown here. In addition, each entry should appear on a single line in your VB.INI file.

Visual Basic Solutions

110

Соседние файлы в папке crystal