I've been playing with the Print Preview capabilities of the grid. Very nice. I would like to provide a fabulous header to my customer that utilize a font with three different pixel sizes. For example:
My left header text (medium size) My right header (medium size)
My big bad report title (big size)
Current Date/Time (small size)
I understand that I can setup a header section using the following:
UltraGridPrintDocument printDocument = new UltraGridPrintDocument(); printDocument.Grid = ultraGrid1; ... // printDocument.Header.BorderStyle = UIElementBorderStyle.None; printDocument.Header.Height = 40; printDocument.Header.Appearance.FontData.SizeInPoints = 14; printDocument.Header.TextLeft = "my left text"; printDocument.Header.TextCenter = "my center text"; printDocument.Header.TextRight = "my right text\r\nsecond line"; printDocument.Header.Appearance.BackColor = Color.Beige; printDocument.Header.Appearance.TextVAlign = VAlign.Top;
This will give me Left, Centered, and Right text but all the same font size. Further I can even futz around and add another print header under the one above during the InitializePrint event using the following:
e.DefaultLogicalPageLayoutInfo.PageHeader = DateTime.Today.ToLongDateString(); e.DefaultLogicalPageLayoutInfo.PageHeaderHeight = 30; e.DefaultLogicalPageLayoutInfo.PageHeaderAppearance.FontData.SizeInPoints = 8; e.DefaultLogicalPageLayoutInfo.PageHeaderAppearance.TextHAlign = HAlign.Center; e.DefaultLogicalPageLayoutInfo.PageHeaderAppearance.TextVAlign = VAlign.Top; e.DefaultLogicalPageLayoutInfo.PageHeaderAppearance.BackColor = Color.Azure; e.DefaultLogicalPageLayoutInfo.PageHeaderBorderStyle = UIElementBorderStyle.None;
This gives me my second font size but not a third. Is there anyway to do this? Background images are not an option.
Any information is welcome.
I don't think you can do this in any obvious way. Using the PrintDocument header and then the page header is a nice idea.
The only way I can think of that this might work is you turn the page header into an image instead of text. Create a Bitmap in code and draw the text onto it so you can draw two lines in two different fonts, then assign the PageHeaderAppearance.Image. I am assuming that the Image property of the PageHeaderAppearance is actually honored. It might not be, though, so I'd recommend testing that out with some random image before you go to the trouble of creating the bitmap.