Git Product home page Git Product logo

drawshape's Introduction

DrawShape

Software Version VS Version MIT License

Japanese Page

Overview

CAD-like ActiveX control to easily draw shapes and easily zoom and pan the displayed content.

  • Usage examples 1

    • use1
  • Usage examples 2

    • use2

Version

v1.1.1

Development Environment

Visual Studio 2019

License

MIT License

OSS used

Install/Uninstall

How to install

  • Case Windows (x86)
    1. Place DrawShape.ocx in a folder of your choice.
    2. Launch the command prompt with administrative privileges.
    3. Run regsvr32 DrawShape.ocx.
  • Case Windows (x64)
    1. Place DrawShape.ocx in a folder of your choice.
    2. Launch the command prompt with administrative privileges.
    3. Run C:\Windows\SysWow64\regsvr32 DrawShape.ocx.

How to uninstall

  • Case Windows (x86)
    1. Place DrawShape.ocx in a folder of your choice.
    2. Launch the command prompt with administrative privileges.
    3. Run regsvr32 /u DrawShape.ocx.
  • Case Windows (x64)
    1. Place DrawShape.ocx in a folder of your choice.
    2. Launch the command prompt with administrative privileges.
    3. Run C:\Windows\SysWow64\regsvr32 /u DrawShape.ocx.

How to use

C++ / MFC Applications (on Visual Studio 2019)

  1. How to Insert a control into a Dialog.
    1. Open the dialog editor from the resource view.
    2. Right-click on the dialog and select "Insert ActiveX Control...".
    3. Select "DrawShape Control" from the "Insert ActiveX Control" window and click the "OK" button.
  2. How to add properties and methods.
    1. Right click on the inserted DrawShape control and select "Add Variable...". to add a control variable.
    2. 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.
  3. How to add an event handlers.
    1. Right click on the inserted DrawShape control and select "Add Event Handler...".
    2. In the wizard that appears, specify the event you want to add and the member function of the handler, and insert it.

C# / Windows Form Applications (on Visual Studio 2019)

  1. How to insert a control into a form.
    1. Open the Form Designer from the Solution Explorer.
    2. Right-click on an empty area of the toolbox and select "Select Item...".
    3. Open the "COM Components" tab in the "Select Toolbox Items" window, check the "DrawShape Control" checkbox, and click the "OK" button.
    4. The "DrawShape Control" is added to the toolbox and inserted into the form.
    5. 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.
  2. How to add properties and methods.
    1. 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.
  3. How to add the event handlers.
    1. 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).

C# Sample Application

Reference

Reference

drawshape's People

Contributors

bugph0bia avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

drawshape's Issues

設計途中のDrawerについてメモ

  • グリッドの最小包含箱は「無し」ではなく描画領域と同じにしておく。
  • 無限直線の最小包含箱はどう考える?描画領域との共通領域チェックで描画可否を判定できるようにしたい。
  • 最小包含箱の論理和と論理積で、片方が不確定の場合に対応
  • 論理積は * で表してもよいのでは?
  • 直線の矢印対応
  • Node::Draw()で、描画判定、ペンブラシ変更、形状描画を行うようにし、形状描画部分を派生クラスでオーバーライドするのがよい
  • C++17を要求する必要はないので、要件を下げる
    • inline定数にC++17が必要だったため取り下げ

AddPolygonがうまく動かない

COMメソッドへ配列を渡す正しい方法を調査中。SafeArrayをVariantでラップ?
C#のテストアプリ側がおかしいのかもしれないが、問題の切り分けはできていない。
C++同士では先頭アドレスの受け渡しでうまく行ったが、正規の方法ではない模様。

機能追加

  • 描画データのセーブ、ロード
  • レイヤーの名称を設定/取得可能とする
  • レイヤーの順序入れ替え

設定値は専用のクラスにまとめる

Drawerについて以下の変更を行う。

  • 外部からの設定値は専用のクラスを作成してまとめる
  • そのクラスはManagerが保持し、Nodeも参照を持つ
  • Canvasは上位からの支持の通りに描画することに専念し、自身で設定値を保持しない

改善

  • マウスダウンイベント対応
  • マウスムーブも独自とするか?
  • ペンブラシはセットとゲットにする
  • カレントレイヤー対象処理はインデックスを渡せるように

テストツール作成

  • フィット・パン・ズーム
  • レイヤー設定
  • 現在位置表示
  • 基本設定
  • ペン・ブラシ設定
  • 関数コール
  • 画像保存・コピー

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.