Article | 41019092 |
Type | HowTo |
Product | Engine |
Version | 3.x |
Date Added | 5/5/2003 |
Submitted by | |
Keywords |
Using VectorDraw 3.x ActiveX in Visual Studio .NET
Knowledge base
Using VectorDraw ActiveX in Visual Studio
.NET
General
VectorDraw components are now fully tested with the VisualStudio .Net.
The ocxs are made with unmanaged code in VC++ and 2 new dlls (the
Interopability dlls) are made with managed code. This is the first step for us to the
.NET platform and in the next steps more and more of the components will be made with managed (assembly) code. We are still researching the potentials of
.NET.
After the Installation VectorDraw run the following command to move the AxVDRAW...Lib.dll and
VDRAW...Lib.dll into the Global Assembly Cache Folder and make the vdraw components share among multiple .NET applications:
Start Menu->Programs Menu->VectorDraw-> VectorDraw 3.6.7.x->.Net-> MakeRCW
To upgrade your projects to the .Net you have to follow the “wizard” The problem is with the conversion of VDraw constants.
For example in VB 6.0 : vdrawlib.vdcolorRED
In VB.NET : vdrawlib.constants.vdColorRED
See also: About VARIANTS in .NET
Please feel free to email us at vdrawnet@vdraw.com
Redistribution
Make sure before you distribute your project to remove from the “References” the:
- AxVDRAWLib and VDRAWLib for VDraw.ocx
- AxVDRAW2DLib and VDRAW2DLib for VDraw2D.ocx
- AxVDRAWILib and VDRAWILib for VDrawI.ocx
and re-insert them (Add Reference) from the default installation setup of VectorDraw.
Also make sure that the Copy Local property of the above AxVDRAW...Lib.dll and
VDRAW..Lib.dll references is False.
When you distribute your projects you need :
1. The OCX to be registered.
2. (Share the component among multiple .NET applications)
The AxVDRAW...Lib.DLL and VDRAW...Lib.DLL, stdole.dll to be added in the “customers’ machines” Global Assembly Cache Folder.(see makercw.bat in VectorDraw installation folder)
3. Merge modules: dotnetfxredist_x86_enu.msm, mfc42.dll, msvcrt.dll,
msvcirt.dll, olepro32.dll, oleaut32.dll (read more at
http://www.vdraw.com/newsite/redistribute_files.htm)
4. If the machine doesn’t have the .NET framework then the dotnetfx.exe setup must be installed first of all.
There is documentation about using ActiveX in .NET: “Using ActiveX Controls with Windows Forms in Visual Studio .NET Upgrading to Microsoft .NET” and about redistribution :
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetdep/html/vsredistdeploy.asp
If you already have a previous version (for VS 6.0) installed: This setup will not trouble you.
About VARIANTS in .NET
In VS.NET (VB and VC) the VARIANT types are automatically converted with Upg Wizard into object types see the following examples:
Example 1
VB 6:
Dim Entity As VDLINE
Dim pt1 As Variant
Dim pt2 As Variant
Set Entity = VDraw.ActiveDocument.Entities.AddLine(Array(-5, -5), Array(5, 5))
pt1 = Entity.StartPoint
pt2 = Entity.EndPoint
VB .NET:
Dim Entity As VDRAWLib.VDLINE
Dim pt1 As Object
Dim pt2 As Object
Entity = VDraw.ActiveDocument.Entities.AddLine(New Object() {-5, -5},
New Object() {5, 5})
pt1 = Entity.StartPoint
pt2 = Entity.EndPoint
In C#:
VDRAWLib.VDLINE Entity;
object pt1,pt2;
Entity = VDraw.ActiveDocument.Entities.AddLine(new object[] {-5, -5},
new object[] {5, 5});
pt1 = Entity.StartPoint;
pt2 = Entity.EndPoint;