Page Index Toggle Pages: 1 Send TopicPrint
Hot Topic (More than 10 Replies) Square shape's handles with own bahaviour class (Read 6667 times)
MUDO
Junior Member
**
Offline



Posts: 90
Joined: Nov 29th, 2008
Square shape's handles with own bahaviour class
Apr 29th, 2010 at 3:25am
Print Post  
Hi.

How to reach ability of changing shape's bounds via its handles in this ituation:
- my own shape class derived from Shape (Actor shape)
- object of shape class has set HandlesStyle = HandlesStyle.EasyMove
- my own behaviour class ClsCustomBehavior derived from WinForms.Behaviors.BehaviorBase
- Me.fcDiagramView.CustomBehavior = New ClsCustomBehavior(Me.fcDiagramView)

Problem is, that there are no handles so Im checking cursor position in my ClsCustomBehavior class. But it is possible only when cursor is in shape area (thats logical). So cursor reacts only on the edge and inside of the shape. Thats why its impossible to change size of this actor shape horizontally. Check this pictuere:




At the first picture is my current situation, second one is what I want. You can also see special triangle for place where link is created from. All this I control in my own behaviour class.

How to keep my own behaviour class and to resize shape via rectangle handles? Do I need to override any function in shape class, bahaviour class?

Thx.

...MUDO...
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Square shape's handles with own bahaviour clas
Reply #1 - Apr 29th, 2010 at 8:21am
Print Post  
Hi,

Are you calling GetNodeAt from the custom behavior class? That would indeed return the node only if the pointer is within the shape. Instead, you can use the diagram.GetNodeAt(PointF, threshold) overloaded method to find the node even if it's a bit away from the pointer, and that hit test relatively to the bounding rectangle of the found node.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
MUDO
Junior Member
**
Offline



Posts: 90
Joined: Nov 29th, 2008
Re: Square shape's handles with own bahaviour clas
Reply #2 - Apr 29th, 2010 at 10:01am
Print Post  
Hi,

Thx for your reply.


Im using GetItemAt method, coz I want to check also links.

So, how to use GetNodeAt method with treshold for actor shape and without treshold for other shapes? Coz I have some rectangle shapes, so theres no problem with this bahaviour - coz its rectangle.

Here is first part of my own behaviour class:

http://rapidshare.com/files/381509257/ClsCustomBehavior.rar.html

Thx.

...MUDO...
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Square shape's handles with own bahaviour clas
Reply #3 - Apr 29th, 2010 at 10:49am
Print Post  
Perhaps you could call GetNodeAt if GetItemAt returns null?
  
Back to top
 
IP Logged
 
MUDO
Junior Member
**
Offline



Posts: 90
Joined: Nov 29th, 2008
Re: Square shape's handles with own bahaviour clas
Reply #4 - Apr 29th, 2010 at 11:09am
Print Post  
Ok, I did it. Thx, but how it can help me? I need to resize that actor shape via rectangle handles.

Any help with this?

...MUDO...
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Square shape's handles with own bahaviour clas
Reply #5 - Apr 29th, 2010 at 3:26pm
Print Post  
You could use the DashFrame handles style instead, and set the frame to a solid line through the Selected/ActiveItemHandlesStyle DashPen property. Or otherwise implement fully custom style and call DrawRectangle in response to the DrawSelectionHandles event.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
MUDO
Junior Member
**
Offline



Posts: 90
Joined: Nov 29th, 2008
Re: Square shape's handles with own bahaviour clas
Reply #6 - May 10th, 2010 at 10:18pm
Print Post  
Hi.

I reframe my issue...

Now I want to have HatchHandles handlesstyle AND I want to be able to create links from that triangle in upper right corner. Is it possible to do that with my own Behaviour class? I dont need it if there is another way... With this class theres problem with detection of non shape areas (as I wrote).

Any other solution?
Thx.

...MUDO...
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Square shape's handles with own bahaviour clas
Reply #7 - May 11th, 2010 at 10:49am
Print Post  
Hi,

What should happen if you start dragging inside the node but not over the triangle?

Stoyan
  
Back to top
 
IP Logged
 
MUDO
Junior Member
**
Offline



Posts: 90
Joined: Nov 29th, 2008
Re: Square shape's handles with own bahaviour clas
Reply #8 - May 11th, 2010 at 10:55am
Print Post  
It could be ok, but Im using my own class of links.

...MUDO...
  
Back to top
 
IP Logged
 
MUDO
Junior Member
**
Offline



Posts: 90
Joined: Nov 29th, 2008
Re: Square shape's handles with own bahaviour clas
Reply #9 - May 13th, 2010 at 2:41am
Print Post  
Hi.

Afte research Im using EasyMove handlesstlye and NOT using my behaviour class.

How to do this:
- create links (MY OWN CLASS!) from center of node (EasyMove --> center)

AND

- do nothing (draw selection rectangle) if click and move in diagram

Maybe Im not using proper combination of DiagramView.ModificationStart and DiagramView.Behavior properties but its not working for me.

Thx for your support.

...MUDO...

  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Square shape's handles with own bahaviour clas
Reply #10 - May 13th, 2010 at 7:49am
Print Post  
It seems this does what you described:

Code
Select All
diagram.ShapeHandlesStyle = HandlesStyle.EasyMove;
diagramView.CustomBehavior = new MyBehavior(diagramView);
diagramView.ModificationStart = ModificationStart.AutoHandles;

public class MyBehavior : DrawLinksBehavior
{
	public MyBehavior(DiagramView view) : base(view)
	{
	}

	protected override DiagramLink CreateLink()
	{
		return new MyLink(Diagram);
	}
} 



I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
MUDO
Junior Member
**
Offline



Posts: 90
Joined: Nov 29th, 2008
Re: Square shape's handles with own bahaviour clas
Reply #11 - May 13th, 2010 at 10:09am
Print Post  
Thx for answer.

And how to do possible to create link from any special rectangle area of node?

In my behaviour class I can determine if cursor is above this rectangle so in StartDraw method I return:
Code
Select All
Return New InteractionState(New ClsMMLinkNode(Diagram), -1, Action.Create)
 



But in other situation I want to original behaviour, but
Code
Select All
Return MyBase.StartDraw(point)
 


is not possible coz its MustInherit method.

...MUDO...
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Square shape's handles with own bahaviour clas
Reply #12 - May 13th, 2010 at 11:48am
Print Post  
It's MustInherit only in the BehaviorBase class, which doesn't have any original behavior you can reuse anyway. Choose one of the specific behavior classes that's closest to what you need and derive from it, e.g. DrawLinksBehavior or LinkShapesBehavior.

Stoyan
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint