Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Customizing the ContainerNode title bar (Read 2846 times)
j poz
Junior Member
**
Offline


I Love MindFusion!

Posts: 78
Joined: Nov 21st, 2012
Customizing the ContainerNode title bar
Mar 28th, 2017 at 5:14pm
Print Post  
Is it possible to add custom controls to the title bar of the ContainerNode?
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3152
Joined: Oct 19th, 2005
Re: Customizing the ContainerNode title bar
Reply #1 - Mar 29th, 2017 at 6:17am
Print Post  
If you use a derived class, you could follow same approach ContainerNode uses to show its fold icon -

Code
Select All
class TestWidget : MindFusion.Diagramming.Manipulators.Manipulator
{
	public TestWidget(DiagramItem item, RectangleF bounds)
		: base(item)
	{
		this.bounds = bounds;
	}

	public override bool HitTest(PointF point)
	{
		return bounds.Contains(point);
	}

	public override void Draw(IGraphics graphics)
	{
		graphics.DrawRectangle(Pens.Blue, bounds);
	}

	public override void OnClick(PointF point)
	{
		MessageBox.Show("click");
	}

	public override bool SupportClipping()
	{
		return false;
	}

	public override void AddToRepaintRect(ref RectangleF rect)
	{
	}

	RectangleF bounds;
}

class TestNode: ContainerNode
{
	public TestNode(Diagram diagram)
		: base(diagram)
	{
		AddManipulator(
			new TestWidget(this, new RectangleF(2, 2, 4, 4)));
	}
} 



Otherwise you could use AttachTo method to attach some helper ControlNode or ShapeNode objects to the container, and handle their click events to modify it.

Regards,
Slavcho
Mindfusion
  
Back to top
 
IP Logged
 
j poz
Junior Member
**
Offline


I Love MindFusion!

Posts: 78
Joined: Nov 21st, 2012
Re: Customizing the ContainerNode title bar
Reply #2 - Jul 14th, 2017 at 4:21pm
Print Post  
This worked well, thank you.

Do you know how we would add a tooltip when the mouse rests over a small area of the container title, and not the entire container?
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3152
Joined: Oct 19th, 2005
Re: Customizing the ContainerNode title bar
Reply #3 - Jul 14th, 2017 at 5:14pm
Print Post  
Try returning it from DiagramNode.GetToolTip(point) override if point is inside the area, or return base result otherwise.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint