0

I need to split a rectangle Rect Structure, Rect(Double X, Double Y, Double Width, Double Height) into a number of smaller rectangles/structures for n = 2, n= 4 and n = 6, i define a Rect for my Diagram (Nodes and Links) that bounds the whole Diagram

Rect b = activeDiagram.Panel.DiagramBounds;

Can someone provide an example of doing it with my structure in C#?

H79
  • 335
  • 1
  • 5
  • 14
  • Can you perhaps provide an example or more information on what you are trying to accomplish? – Steve Czetty Sep 12 '12 at 15:19
  • hi im using PDFSharp for creating PDF-Document for some diagrams. after converting my diagrams in PDF, i should print them on one Page for very small Diagrams, but if i have big-Diagrams then printing them on one Page produce a bad Printing quality the diagram will be small displayed and the diagram content is not readable. becuase of that i want to split splint diagrams in 2 Parts or 4 Parts depending on there Size – H79 Sep 13 '12 at 07:54

1 Answers1

2

I'm not 100% sure I understand your question completely, but is it as simple as slicing it up in one direction?

Rect[] smallerRects = new Rect[n];
for(int i = 0;i < n;++i)
   smallerRects[i] = new Rect(b.X + b.Width / n * i, b.Y, b.Width / n, b.Height);
itsme86
  • 19,266
  • 4
  • 41
  • 57