Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Adjustment handles draw order (Read 2897 times)
j poz
Junior Member
**
Offline


I Love MindFusion!

Posts: 78
Joined: Nov 21st, 2012
Adjustment handles draw order
Jul 29th, 2014 at 5:01pm
Print Post  
Is there a way I can draw the adjustment handles before the Draw() method gets called on a ShapeNode?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Adjustment handles draw order
Reply #1 - Jul 29th, 2014 at 6:13pm
Print Post  
If using a derived node type, you could implement that by overriding Draw and DrawHandles:

Code
Select All
public override void Draw(IGraphics graphics, RenderOptions options)
{
	if (this == Parent.ActiveItem)
		base.DrawHandles(graphics, Parent.ActiveItemHandlesStyle, options);
	else if (Selected)
		base.DrawHandles(graphics, Parent.SelectedItemHandlesStyle, options);

	base.Draw(graphics, options);
}

public override void DrawHandles(IGraphics graphics, HandlesVisualStyle style, RenderOptions options)
{
} 



For standard nodes you could draw handles in the background by handling DrawBackground event and calling Selection.Draw:

Code
Select All
private void diagram_DrawBackground(object sender, DiagramEventArgs e)
{
	diagram.Selection.Style = SelectionStyle.SelectionHandles;
	diagram.Selection.Draw(e.Graphics, new RenderOptions());
} 



but then you will have to stop standard handle rendering in some way, e.g. by assigning transparent brushes to ActiveItemHandlesStyle and SelectedItemHandlesStyle.

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


I Love MindFusion!

Posts: 78
Joined: Nov 21st, 2012
Re: Adjustment handles draw order
Reply #2 - Jul 29th, 2014 at 8:13pm
Print Post  
This works, except that now the mouseover does not show the handles..
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Adjustment handles draw order
Reply #3 - Jul 30th, 2014 at 8:26am
Print Post  
This should show the mouse-over handles too:

Code
Select All
public override void Draw(IGraphics graphics, RenderOptions options)
{
	var view = options.TargetView as DiagramView;
	if (view != null && view.AutoHandlesItem == this ||
		this == Parent.ActiveItem)
		base.DrawHandles(graphics, Parent.ActiveItemHandlesStyle, options);
	else if (Selected)
		base.DrawHandles(graphics, Parent.SelectedItemHandlesStyle, options);

	base.Draw(graphics, options);
} 



I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint