Using standard .NET controls in VCL .NET applications with Delphi 8

By: John Kaster

Abstract: A step by step guide to importing a BCL Winforms component into a VCL package for use in a VCL application

by Tim Jarvis and John Kaster

Delphi 8 installs a utility into the Delphi 8 program group (available from the start button) called "WinForms Control Import Wizard". You can use this utility to wrap standard .NET controls for using in a VCL application. This is the menu displayed in the Delphi program group:

Select the last menu option and you should see this dialog:

This wizard allows you to navigate to an assembly that contains an FCL component (for example a winforms DataGrid contained in C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.Windows.Forms.dll )

After navigating to the assembly, you will get a list of all the controls contained in the assembly. Select the one you want.

You can also use the wizard to specify what parts of the control to wrap.

For our example, the defaults are what we want. We can then specify where the generated files should be written, and what the package assembly should be named.

You are prompted to confirm the overwrite of existing files.

When you select next, the wrapper unit will be created and the package project files will be created.

Note: The package will not be compiled. You will need to load the package project into Delphi 8 and compile it.

Click finish to close the Wizard.

Next, we'll load the package project into the IDE.

The project manager displays it.

Compile the project, you will now have a VCL package assembly that contains a wrapper around the FCL component.

Now we need to install the package so that we can use it in a VCL application. Select "Installed .NET components..." from the component menu, or select it by right-mouse clicking on the component palette, and you should see the following dialog. Click on the .NET VCL components tab.

Note: The first time you select this dialog, it will take a while to compose the list of all assemblies on your machine, and the components that are available in them.

Click on Add and navigate to the package assembly dll

The package and component is now installed and ready to be used.

We should now see this component in our palette and can use this in our VCL forms application.

About the author

Tim Jarvis is a Senior Consultant and Microsoft .NET specialist for Borland Europe


Server Response from: ETNASC04