I need to do some Page Setup before printing, i.e. like paper size, orientation, etc. I tryed to use UltraPrintPreviewDlg - but seems no page setup there. Then I tryed to create my own PageSetupDlg and call it inside grid_InitializePrint but seems too many popups because I also call PrintSetupDlg for setting Titles and Footers there. Is it better to call PageSetupDlg from grid_BeforePrint? Good example of using Page Setup for printing is really appreciated.
I am trying to do Header but my image aligned to center though I set align to left:
e.DefaultLogicalPageLayoutInfo.PageHeaderAppearance.ImageBackground = Image.FromFile(VWAPath.ViewWasteBackgroundImage); e.DefaultLogicalPageLayoutInfo.PageHeaderAppearance.ImageBackgroundStyle = Infragistics.Win.ImageBackgroundStyle.Default;//.Stretched; e.DefaultLogicalPageLayoutInfo.PageHeaderAppearance.ImageHAlign = HAlign.Left;
e.DefaultLogicalPageLayoutInfo.PageHeader = " Mila";
e.DefaultLogicalPageLayoutInfo.PageHeaderHeight = 40; e.DefaultLogicalPageLayoutInfo.PageHeaderAppearance.FontData.Bold = Infragistics.Win.DefaultableBoolean.True; e.DefaultLogicalPageLayoutInfo.PageHeaderAppearance.TextHAlign = Infragistics.Win.HAlign.Center; e.DefaultLogicalPageLayoutInfo.PageHeaderAppearance.FontData.SizeInPoints = 20;
Hi Klimia,
You can avoid the extra components and try to use the ultragrid.print() method
after callin the method grid.print()
use the initializeprint event and play with the options available,,
Private Sub UltraGrid1_InitializePrint(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinGrid.CancelablePrintEventArgs) Handles UltraGrid1.InitializePrint
e.PrintLayout.Bands(0).Override.HeaderPlacement = HeaderPlacement.RepeatOnBreak
e.DefaultLogicalPageLayoutInfo.PageHeader = "Sample header"
e.DefaultLogicalPageLayoutInfo.PageFooter = "Sample footer"
e.PrintDocument.PrinterSettings.DefaultPageSettings.PaperSize
e.PrintDocument.DefaultPageSettings.Landscape = True
End Sub
hppy koding,
Arun