RAD Studio for Microsoft .NET
ContentsIndex
PreviousUpNext
Importing .NET Controls to VCL.NET

You might want to use .NET components on your VCL.NET forms. There is no direct way to use .NET components. You can, however, wrap the components in an ActiveX wrapper, which then can be added to your VCL.NET application. RAD Studio provides the .NET Import Wizard to accomplish this task.

To use .NET components in a VCL.NET Form

  1. Run the WinForm Control Import Wizard.
  2. Build the package to create an assembly file.
  3. Add the assembly to the Tool Palette.

To run the WinForm Control Import Wizard

  1. Choose FileNewOtherDelphi for .NET ProjectsWinForm Controls Package. This starts the WinForm Control Import Wizard.
  2. Specify the following file:

c:\Windows\Microsoft.NET\Framework\v1.1.4322\System.Windows.Forms.dll

  1. Click Next. This displays the second page of the WinForm Control Import Wizard and lists all of the available components.
  2. Check the check boxes next to the components you want to import.
    Note: If you want to import all components, click the Check All
    button.
  3. Click Next. This displays the third page of the Wizard, which provides generation options for the units.
  4. Accept the defaults, and click Next. This displays the fourth page of the Wizard, which allows you to set a location and a name for the package file.
  5. Click Next. This displays the fifth page of the Wizard, which allows you to overwrite any existing files of the same name.
  6. Click Next. This initiates the generation process and displays status messages for each file as it is created, including the package (.dpk) file.
  7. If you want to import additional controls, click New. Otherwise, click Finish. The package containing the units appears in the Project Manager.

To build and add the package

  1. Select the package node in the Project Manager.
  2. Choose ProjectBuild <Project Name> from the main menu where <Project Name> is the name of your project. This creates the assembly file containing the package and the units.
  3. Choose ComponentsInstalled .NET Components.
  4. Click the .NET VCL Components tab.
  5. Click Add.
  6. Locate the package assembly, select it, and click Open. The location depends on your project options directory locations. The file might also end up in your default documents directory.
  7. Click OK. The individual controls appear in the Tool Palette under the WinForm Controls category. You can now add the individual controls to your VCL.NET form applications.

Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
What do you think about this topic? Send feedback!