Hi
We are using the UltraGanttViewPrintDocument for printing the GanttViewControl in our product.
Our Customer is asking now, if it is possible to print the GanttView with his company logo in the top right corner of every page.
We tried to set an image with
ganttViewPrintDocument.PageBody.Appearance.Image and ultraGanttView.BackgroundImage
but with no success.
Could you give us a hint, how a Background Image or a Watermark can be set to the UltraGanttViewPrintDocument?
Thx
Marco
Hi Marco,
Not every object supports every property of the Appearance. So it's possible that PageBody.Appearance simply does not support Image or ImageBackground.
I tried applying an image using the PrintGanttView sample, though, and it seems to me that the GanttView control itself covers the entire page, anyway. So even if PageBody supports images, they would simply get drawn over by the GanttView control.
So I tried making the GanttView transparent for printing, but apparently, the control itself does not support Transparency.
I think the simplest thing for you to do would be to draw the image onto the page on top of the GanttView.
private void UltraGanttViewPrintDocument1_PagePrinted(object sender, PagePrintedEventArgs e) { Rectangle pageRect = e.PageBodyRect; Rectangle imageRect = new Rectangle(Point.Empty, image.Size); Infragistics.Win.DrawUtility.AdjustHAlign(HAlign.Right, ref imageRect, pageRect); Infragistics.Win.DrawUtility.AdjustVAlign(VAlign.Top, ref imageRect, pageRect); e.Graphics.DrawImage(image, imageRect.Location); }
The problem with this code is that the image covers the GanttView. So you will need to use an image that is semi-transparent. I found some code to change the opacity of an image here:
https://stackoverflow.com/questions/2201016/how-to-make-a-system-drawing-image-semitransparent
Hi Mike
Your approach helped me to develop a solution. Thank you!