VS, being 32bit, makes this a big pain for 64bit activex controls. For achieving that You need to add edrawing dynamically into your winform dialog. Here is the snippet of code:-
edrawing control host wrapper class:
partial class eDwHost : System.Windows.Forms.AxHost
private dynamic ocx;
protected override void AttachInterfaces()
if (IntPtr.Size == 8) //64 bit
// "Forced compiler error! This code can never work in 32-bit processes since it depends on an ActiveX contronl which is only available in 64-bit."
this.ocx = (dynamic)base.GetOcx();
MessageBox.Show(ex.Message + "\r\n\r\n" + ex.StackTrace, "Exception loading eModelViewControl");
public new dynamic GetOcx()
And in your winform code :-
eDwHost hostContainer = new eDwHost();
giveproperties to hostContainer
//((Control)hostContainer).Location // NOTE : base class is Control
//hostContainer.Size// NOTE : base class is Control
//hostContainer.AutoSize// NOTE : base class is Control
//hostContainer..Enabled// NOTE : base class is Control
To Add in winform:-
To get edrawing for apis:-
dynamic emvControl = hostContainer.GetOcx();
emvControl.OpenDoc(sViewFilePath, false, false, true, "");
Please note that I have got this from SW forum only. If you get the original post then add links to them also.
BTW : If you want try out Edrawing code for test and trial purpose then you can use it in your VBA7 editor (e.g. 64Bit excel VBA or Solidworks VBA). This makes trial code work faster as you can add then using VBA7 IDE and once you are confident then add same code in your main project in visual studio. Thats how I do it myself.
FYI: VS development team doesnt want to make VS in 64 bit in near future.
thanks a lot.
I am starting learning the C# program now ...