Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Set diagram bounds to lanegrid (Read 1659 times)
tom_w
Junior Member
**
Offline


Swimlanes made our dreams
come true :-)

Posts: 79
Joined: Oct 20th, 2008
Set diagram bounds to lanegrid
Oct 20th, 2008 at 5:08pm
Print Post  
Hi there

I'm creating a lane flowchart and would like to limit its minimum width (it is only one cell wide). Is this possible?

Also, is there an easy way to set the document boundary to match the size of the lane grid (including headers)?

Thanks

Tom
  
Back to top
 
IP Logged
 
Meppy
God Member
*****
Offline


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: Set diagram bounds to lanegrid
Reply #1 - Oct 21st, 2008 at 11:36am
Print Post  
You can achieve both your goals by handling the CellBoundsChanged event of the Lanes.Grid class. Here is how:

First, attach a handler to the event. The code below assumes that diagram1 is a variable identifying a valid Diagram object.

Code
Select All
diagram1.LaneGrid.CellBoundsChanged +=
	new CellBoundsEventHandler(LaneGrid_CellBoundsChanged); 


The implementation of the event handler takes care to perform the necessary width check and to update the bounds of the document:

Code
Select All
private void LaneGrid_CellBoundsChanged(object sender, CellBoundsEventArgs e)
{
	if (diagram1.LaneGrid.ColumnHeaders[0].Width < 100)
		diagram1.LaneGrid.ColumnHeaders[0].Width = 100;

	RectangleF columnHeaderBounds = diagram1.LaneGrid.GetColumnHeaderBounds();
	RectangleF rowHeaderBounds = diagram1.LaneGrid.GetRowHeaderBounds();

	RectangleF laneGridBounds = RectangleF.Union(columnHeaderBounds, rowHeaderBounds);

	diagram1.Bounds = laneGridBounds;
} 



Meppy
  
Back to top
 
IP Logged
 
tom_w
Junior Member
**
Offline


Swimlanes made our dreams
come true :-)

Posts: 79
Joined: Oct 20th, 2008
Re: Set diagram bounds to lanegrid
Reply #2 - Oct 21st, 2008 at 1:50pm
Print Post  
Thanks Meppy, I will give this a go - looks a lot neater than my existing 'solution'!
  
Back to top
 
IP Logged
 
tom_w
Junior Member
**
Offline


Swimlanes made our dreams
come true :-)

Posts: 79
Joined: Oct 20th, 2008
Re: Set diagram bounds to lanegrid
Reply #3 - Oct 21st, 2008 at 4:38pm
Print Post  
Perfect, that worked a treat, many thanks  Smiley
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint