Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Drawing the selection hatch (Read 2008 times)
JonathonB
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 7
Joined: Apr 10th, 2007
Drawing the selection hatch
Aug 22nd, 2008 at 12:18pm
Print Post  
Hi,

I'm looking to have two or more nodes 'linked' to one another on the FlowChart. That is, when one node has been clicked, the others that it is linked to will display the selection hatch around themselves (each individually). This list of 'linked' nodes is stored in my own array.

I can do this by setting the 'Selected' property for the nodes that I want to be linked, but this will stop me from being able to resize the initally clicked node using the mouse. I'm not really worried about the others being selected - all I'm looking to do is give the visual impression that they are.

Each of the nodes get their drawn by ourselves so I would be able to modify the ondraw event for each of the nodes I want - but what I'm wondering is: is there any way to draw that selection box for multiple controls, but not actually select them (would this be the flowchart's on draw?)? Or would it be possible to have all controls selected, but be able to resize only one?

Has anyone come across a similar issue?

Thanks for any help,

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Drawing the selection hatch
Reply #1 - Aug 22nd, 2008 at 12:33pm
Print Post  
Hi,

You can call the DiagramItem.DrawHandles() method from your custom draw handler.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
JonathonB
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 7
Joined: Apr 10th, 2007
Re: Drawing the selection hatch
Reply #2 - Aug 22nd, 2008 at 1:22pm
Print Post  
Hi,

Thanks for the quick reply and advice but I am unable to find the DrawHandles() method - I probably should have mentioned I'm using the 4.2.1 version (which as far as I know is pre-DiagramItem).

Is a similar method available on 4.2.1? Smiley

Thanks,
Jonathon
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Drawing the selection hatch
Reply #3 - Aug 22nd, 2008 at 2:36pm
Print Post  
It is available, however it's internal there 8) Anyway, this is how Flowchart.NET draws the hatch frame:

Code
Select All
if (st == HandlesStyle.HatchFrame)
{
	rc.Inflate(size / 2, size / 2);

	System.Drawing.Drawing2D.HatchBrush hatchBrush =
		new System.Drawing.Drawing2D.HatchBrush(
		HatchStyle.BackwardDiagonal, Color.Black, Color.White);

	RectangleF[] rects = new RectangleF[]
	{
		new RectangleF(rc.Left + size, rc.Top, rc.Width - 2 * size, size),
		new RectangleF(rc.Left + size, rc.Bottom - size, rc.Width - 2 * size, size),
		new RectangleF(rc.Left, rc.Top, size, rc.Height),
		new RectangleF(rc.Right - size, rc.Top, size, rc.Height)
	};

	for (int i = 0; i < 4; ++i)
		graphics.FillRectangle(hatchBrush, rects[i]);

	hatchBrush.Dispose();

	return;
}
 



I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
JonathonB
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 7
Joined: Apr 10th, 2007
Re: Drawing the selection hatch
Reply #4 - Aug 22nd, 2008 at 2:41pm
Print Post  
I was just eyeing up that part of the mindfusion code (noticed it was internal though) Smiley

That should hopefully solve what I'm looking to do.

As usual, thank you very much Stoyan
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint