This project has moved and is read-only. For the latest updates, please go here.

Using NShape in creating IDEF3 editor

Sep 15, 2012 at 10:20 PM

I write IDEF3 editor, and I have some questions about NShape :

1) How can I create a new shape like a Unit of Behavior (UOB) boxes (http://en.wikipedia.org/wiki/IDEF3) ?

Can I create a new shape from some basic shapes ?

2) How to disable the rotation of some shapes ?

3)  How to disable/hide some menu items (When I right-click on the shape)?

For ex. : I want to hide a "Group Shapes", "Create Template", etc.

Sep 17, 2012 at 11:57 AM
Zool wrote:
1) How can I create a new shape like a Unit of Behavior (UOB) boxes (http://en.wikipedia.org/wiki/IDEF3) ?
   Can I create a new shape from some basic shapes ?

You can derive a new shape based on one of the base classes. A list of base classes can be found in the documentation:

Programmer Tasks > Developing a New Shape Class > Creating the Shape Class

See this thread for details on how to implement a new shape library:
"how can i get ImageBaseShape to rotate?"

You can also have a look on the FlowChartShape library in the source code.

 

Zool wrote:
2) How to disable the rotation of some shapes ?

Override the HasControlPointCapability method:

        public override bool HasControlPointCapability(ControlPointId controlPointId, ControlPointCapabilities controlPointCapability) {
            // Most shapes use 9 as the center point's ControlPointId.
            // The center point is the reference point and a connection point
            if (controlPointId == 9)
                return ((controlPointCapability & ControlPointCapabilities.Reference) != 0 ||
                    ((controlPointCapability & ControlPointCapabilities.Connect) != 0 && base.IsConnectionPointEnabled(controlPointId)));
            else return base.HasControlPointCapability(controlPointId, controlPointCapability);
        }

 

Zool wrote:
3)  How to disable/hide some menu items (When I right-click on the shape)?

See documentation:
Programmer Tasks > Customizing Context Menus
and
Programmer Tasks > Controlling User Access

I would recommend to restrict your user's permissions and hide the menu items that are not permitted.

We included a new sample program called "Security Demo" in the latest release where you can play around with different security settings and their influence on the context menu, the mouse and the property editor.