ComponentOne Preview Classic for WinForms: ComponentOne Preview Classic for WinForms Overview > Adding Preview Classic for WinForms Components to a Project

Adding Preview Classic for WinForms Components to a Project

When you install ComponentOne Studio for WinForms, the Create a ComponentOne Visual Studio 2008/2005 Toolbox Tab checkbox is checked, by default, in the installation wizard.  When you open Visual Studio, you will notice a ComponentOne Studio for WinForms tab containing the ComponentOne controls has automatically been added to the Toolbox.

If you decide to uncheck the Create a ComponentOne Visual Studio 2008/2005 Toolbox Tab checkbox during installation, you can manually add ComponentOne controls to the Toolbox at a later time.

ComponentOne Preview Classic for WinForms provides the following controls:

      C1PrintDocument

      C1PrintPreview

To use Preview Classic for WinForms, add these controls to the form or add a reference to the C1.Win.C1PrintPreview.Classic and C1.C1PrintDocument.Classic assemblies to your project.

Manually Adding Preview Classic for WinForms to the Toolbox

When you install Preview Classic for WinForms, the following Preview Classic for WinForms components will appear in the Visual Studio Toolbox customization dialog box:

      C1PrintDocument

      C1PrintPreview

To manually add the Preview Classic for WinForms controls to the Visual Studio Toolbox:

1.   Open the Visual Studio IDE (Microsoft Development Environment). Make sure the Toolbox is visible (select Toolbox in the View menu if necessary) and right-click it to open the context menu.

2.   To make Preview Classic for WinForms component appear on its own tab in the Toolbox, select Add Tab from the context menu and type in the tab name, C1Preview Classic, for example.

3.   Right-click the tab where the component is to appear and select Choose Items from the context menu.

The Choose Toolbox Items dialog box opens.

In the dialog box, select the .NET Framework Components tab. Sort the list by Namespace (click the Namespace column header) and check the check boxes for all components belonging to namespaces C1.Win.C1PrintPreview and C1.C1PrintDocument. Note that there may be more than one component for each namespace.

Adding Preview Classic for WinForms to the Form

To add C1Preview Classic to a form:

1.   Add it to the Visual Studio Toolbox.

2.   Double-click the control or drag it onto your form.

Adding a Reference to the Assembly

To add a reference to the Preview Classic for WinForms assembly:

1.   Select the Add Reference option from the Project menu of your project.

2.   Select the ComponentOne PrintPreview and ComponentOne PrintDocument assemblies from the list on the .NET tab or browse to find the C1.Win.C1PrintPreview.Classic.2.dll and C1.C1PrintDocument.Classic.2.dll files and click OK.

3.   Double-click the form caption area to open the code window. At the top of the file, add the following Imports statements (using in C#):

Imports C1.Win.C1PrintPreview

Imports C1.C1PrintDocument

Note: This makes the objects defined in the Preview Classic for WinForms assembly visible to the project. See Namespaces for more information.


Send comments about this topic to ComponentOne.
Copyright © 1987-2010 ComponentOne LLC. All rights reserved.