C#: Late binding ActiveX control on a form

Aug 16 2012 7:35 AM
I'm using DWG True View 2013 Activex control (AcCtrl.dll) in my form to display DWG files.
On client machine, there is a possibility that DWG True View might not be installed and so the control would not be displayed.

For this purpose, I'm trying to late bind this ActiveX instead of early binding using following code:
        object oDWGTrueView;
        Type oDWGTrueViewType;
        oDWGTrueViewType = Type.GetTypeFromProgID("Autodesk.AcCtrl");
        if(oDWGTrueViewType==null)
            throw new Exception("DWG True View not found");

        oDWGTrueView = Activator.CreateInstance(oDWGTrueViewType);
        if (oDWGTrueView == null)
            throw new Exception("Cannot create instance of the DWG True View");

Now this seems to be working fine (i.e. not throwing any exception), but the confusion is

How to draw this ActiveX on my form now?

Any help would be really appreciated

Farrukh


Answers (3)