sajith tg

sajith tg

  • NA
  • 7
  • 0

How to set the size of ContainerVisual in WPF

Mar 5 2012 11:40 PM
hi,

iam writing a custome paginator for flowdocument. i used Matrix Transform to set the position of the

Condainervisual .suppose if i set the MatrixTransform as new MatrixTransform(1,0,0,1,0,140) that means that particular CondainerVisual

will start from offsety(140) and if i have a footer in my page the condense of that CondainerVisual will float over the footer because we r setting matrixTransform.offsety(140).

how can i avoid this.can we set the size of condainervisual so that condense will only fit with that size and we can stop the data floating over the footer.

Code::

public override DocumentPage GetPage(int pageNumber) {
DocumentPage source = paginator.GetPage(pageNumber); // Returns next page for processing
DrawingVisual result = new DrawingVisual(); // This is the target output structure
result.Children.Add(Header()); // Needs no transformation
IContentHost contentHost = (IContentHost)source;
HostedElements(contentHost,result);
ContainerVisual body = new ContainerVisual();
body.Children.Add(source.Visual);
body.Transform = pageNumber == 0 ? new MatrixTransform(1,0,0,1,0,100) : new MatrixTransform(1,0,0,1,0,140);
result.Children.Add(body);
result.Transform = new TranslateTransform(margin.Width,margin.Height);
ContainerVisual footer = Footer(pageNumber);
footer.Transform = new MatrixTransform(1,0,0,1,0,820); // Move to bottom of page
result.Children.Add(footer);
isPageBreak = true;
return new DocumentPage(result,size,source.BleedBox,source.ContentBox);
}

Regards,
sajith