Dear,
U provided facility Print , Print Preview in File Menu.(Which are give in sample) but do not provide Page Setup facility in File Menu.
Pl. provide sample with Page setup facility.
Regards:
Sudhanshu
Dear,
U provided facility Print , Print Preview in File Menu.(Which are give in sample) but do not provide Page Setup facility in File Menu.
Pl. provide sample with Page setup facility.
Regards:
Sudhanshu
PageSetupDialog is just a standard part of .NET.
The following code overrides two methods of GoView to always show the PageSetup dialog first, and also rescales the printing to fit a page:protected DialogResult ShowPageSetupDialog(PrintDocument pd) {
PageSetupDialog dlg = new PageSetupDialog();
dlg.Document = pd;
DialogResult result = dlg.ShowDialog();
if (result != DialogResult.OK) return result;
SizeF docsize = this.PrintDocumentSize;
if (docsize.Width > 1 || docsize.Height > 1) {
Rectangle b = pd.DefaultPageSettings.Bounds;
Margins m = pd.DefaultPageSettings.Margins;
float w = b.Width - (m.Left + m.Right);
float h = b.Height - (m.Top + m.Bottom);
float ratio = Math.Min(w/docsize.Width, h/docsize.Height);
if (ratio > 1)
ratio = 1;
this.PrintScale = ratio;
return DialogResult.OK;
}
return DialogResult.Cancel;
}
protected override DialogResult PrintShowDialog(PrintDocument pd) {
if (ShowPageSetupDialog(pd) == DialogResult.OK) {
return base.PrintShowDialog(pd);
} else {
return DialogResult.Cancel;
}
}
protected override void PrintPreviewShowDialog(PrintDocument pd) {
if (ShowPageSetupDialog(pd) == DialogResult.OK) {
base.PrintPreviewShowDialog(pd);
}
}
thanks