CAD-like ActiveX control to easily draw shapes and easily zoom and pan the displayed content.
v1.1.1
Visual Studio 2019
MIT License
- Case Windows (x86)
- Place
DrawShape.ocx
in a folder of your choice. - Launch the command prompt with administrative privileges.
- Run
regsvr32 DrawShape.ocx
.
- Place
- Case Windows (x64)
- Place
DrawShape.ocx
in a folder of your choice. - Launch the command prompt with administrative privileges.
- Run
C:\Windows\SysWow64\regsvr32 DrawShape.ocx
.
- Place
- Case Windows (x86)
- Place
DrawShape.ocx
in a folder of your choice. - Launch the command prompt with administrative privileges.
- Run
regsvr32 /u DrawShape.ocx
.
- Place
- Case Windows (x64)
- Place
DrawShape.ocx
in a folder of your choice. - Launch the command prompt with administrative privileges.
- Run
C:\Windows\SysWow64\regsvr32 /u DrawShape.ocx
.
- Place
- How to Insert a control into a Dialog.
- Open the dialog editor from the resource view.
- Right-click on the dialog and select "Insert ActiveX Control...".
- Select "DrawShape Control" from the "Insert ActiveX Control" window and click the "OK" button.
- How to add properties and methods.
- Right click on the inserted DrawShape control and select "Add Variable...". to add a control variable.
- The IDispatch wrapper class will be automatically inserted into the project and the control variables of the type of the class will be added.
The member functions of the wrapper class will have Getter/Setter properties and methods.
- This is supposed to be the case, but it does not work in Visual Studio 2017 / 2019; it works fine in 2013.
- How to add an event handlers.
- Right click on the inserted DrawShape control and select "Add Event Handler...".
- In the wizard that appears, specify the event you want to add and the member function of the handler, and insert it.
- How to insert a control into a form.
- Open the Form Designer from the Solution Explorer.
- Right-click on an empty area of the toolbox and select "Select Item...".
- Open the "COM Components" tab in the "Select Toolbox Items" window, check the "DrawShape Control" checkbox, and click the "OK" button.
- The "DrawShape Control" is added to the toolbox and inserted into the form.
- If the insertion fails, click "Add Reference..." in the "Project" menu. If the insertion fails, check "DrawShapeLib" in the "COM" page of the "Project" menu and click the "OK" button.
- How to add properties and methods.
- By inserting the control, the AxDrawShape class (AxDrawShapeLib namespace - AxDrawShape class) is added to the project reference and the control variables are of the type of that class. The control variables are of the class type. The properties and methods are also added and ready to use.
- How to add the event handlers.
- Event handler functions can be added by using the event variables and delegate types that have been added to the AxDrawShape class (AxDrawShapeLib namespace - AxDrawShape class).