I'm trying to do something that I thought would be simple. I have several graphic objects that I'm trying to put into a Site. The number of items is not determined at design time and are (more or less) identical ( identical with the exception of some text). The objects are circles that need to remain (as you might expect) as circles.
My problem is that regardless of the settings I use the circles are stretched vertically so that the total height of the items fills the page... so my circles become ellipses.
My first attempt was to create a "flow" and to just insert the site objects to fixed height and width and then add the items as in the following
foreach( String person in myListOfPeople) { Report.ISite site = cell.AddSite(); site.Height = new Report.FixedHeight(cellHeight); site.Width = new Report.FixedWidth(cellWidth);
Infragistics.Documents.Report.Shapes.IEllipse outerCircle = site.Shapes.AddEllipse(); outerCircle.Height = 275; outerCircle.Width = 275; outerCircle.Pen = blackWidePen; outerCircle.X = (cellWidth - 275) / 2; outerCircle.Y = (cellHeight - 275) / 2; Report.IImage logoImage = site.AddImage(logo, outerCircle.X + 35, outerCircle.Y + 25); logoImage.KeepRatio = true; logoImage.Height = new Report.FixedHeight(94); //logoImage.Width = new Report.FixedWidth(113); Infragistics.Documents.Report.Shapes.IEllipse innerCircle = site.Shapes.AddEllipse(); innerCircle.Height = 75; innerCircle.Width = 75; innerCircle.Pen = blackWidePen; innerCircle.X = (cellWidth - 75) / 2; innerCircle.Y = (cellHeight - 75) / 2; Infragistics.Documents.Report.Shapes.ILine cutLine = site.Shapes.AddLine(); cutLine.Pen = blackDashPen; cutLine.X1 = cellCenterX + (innerCircle.Width/2); cutLine.Y1 = cellCenterY; cutLine.X2 = cellCenterX + (outerCircle.Width / 2); cutLine.Y2 = cellCenterY; Infragistics.Documents.Report.Shapes.ILabel nameLabel = site.Shapes.AddLabel(); nameLabel.Text = person; nameLabel.Font = nameFont; nameLabel.Brush = darkBlueBrush; Size proposedSize = new Size(int.MaxValue, int.MaxValue); Size nameSize = System.Windows.Forms.TextRenderer.MeasureText(taster, namedrawingFont, proposedSize, textFlags); Single fontHeight = Infragistics.Documents.Utils.Converter.PixelsToPoints(nameSize.Height); Single fontWidth = Infragistics.Documents.Utils.Converter.PixelsToPoints(nameSize.Width); nameLabel.Y = cellCenterY + (innerCircle.Width/2)+ fontHeight; nameLabel.X = cellCenterX -(fontWidth / 2); }
This seems to work properly in print preview but when I actually do the "report.Print" the items are stretched vertically to fill the page.
I then tried to put the items into a grid setting the grid row height and cell width to be fixed .. same issue, looked ok on print preview but now when actually printed.
I assume that I'm just missing something obvious here but I have not found the key yet.
Neil
Hi Neil,
If this is working okay in the Print Preview, but changes when you actually print, then it would seem something is happening on the Printer to change the aspect ratio. Is it just the shape of the circles that is changing? Or is the text being stretched as well?
Everything was streatched. If I print form print preview to a PDF printer I get the same problem. If I just export directly to PDF it works fine. Go figure.
It sounds to me like a bug, then. The print method may not be taking the actual size of the page or the margins into account.You should Submit an incident to Infragistics Developer Support.
Have you looked at the Document Exporter sample in the WinGrid samples explorer? The sample uses the Generate method of the report to generate images of the pages and uses this to show a print preview. It does some adjustments for the page size, so this might be a more reliable method to use and also allow you to show a print preview instead of printing directly.