How do I embedd an ocx

N

Nuno Magalhaes

How do I embedd an ocx control in a windows form in C#? Does it inherit
from Microsoft.Windows.Forms.Form?

Thanks for any response to this newbie question,
Nuno Magalhaes.
 
G

Guest

The OCX itself cannot be directly used, but with a Runtime Callable Wrapper
(RCW) you can.

If you just want to use the OCX within a single application, you can simply
right click on the Toolbox and choose ‘Add/Remove items...’. After the
Customize Toolbox window appears, select the COM Components tab and locate
the OCX you want to use from the list. If it does not appear in the list,
simply browse.

With your component selected, hit the OK button and you should find a couple
of new references added to the project which are is the RCW needed for this
control.

Finally, you simply drag the component from the toolbox to your form and use
it like you would use most other .NET controls.

To answer your last question, no, it does not inherit from
System.Windows.Forms.Form, however the RCW does cause it to inherit from
System.Windows.Forms.Control, making it addable to a Form.

Brendan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top