protected void preview() { ActivePrintPreviewDialog previewDlg = new ActivePrintPreviewDialog(); //Printdoucment PrintDocument pd = new PrintDocument(); pd.PrintPage += new PrintPageEventHandler(PrintImage); pd.OriginAtMargins = true; // Pass the Aspose.Words print document to the Print Preview dialog. previewDlg.Document = pd; // Specify additional parameters of the Print Preview dialog. previewDlg.ShowInTaskbar = true; previewDlg.MinimizeBox = true; previewDlg.PrintPreviewControl.Zoom = 1; previewDlg.Document.DocumentName = "TestName.doc"; previewDlg.WindowState = FormWindowState.Maximized; // Show the appropriately configured Print Preview dialog. previewDlg.ShowDialog(); }
void adornerWindow_BitmapCropped(object sender, EventArgs e) { if (adornerWindow.DragStop != adornerWindow.DragStart) { Rectangle rect = Rectangle.FromLTRB(adornerWindow.DragStart.X, adornerWindow.DragStart.Y, adornerWindow.DragStop.X, adornerWindow.DragStop.Y); CopyResultToClipBoard(rect); if (this.AutoSaveImages) { string path = Environment.GetFolderPath(Environment.SpecialFolder.MyPictures); string fileName = "Snap_" + DateTime.Now.Ticks.ToString() + Guid.NewGuid().ToString().Substring(0, 2) + ".jpg"; bitmapCache.Save(Path.Combine(path, fileName), ImageFormat.Jpeg); } // if (this.PreivewEnabled) { ActivePrintPreviewDialog preview = new ActivePrintPreviewDialog(bitmapCache); preview.Tag = this; preview.Show(); } /* PrintBitmap(bitmapCache); this.notifyIcon1.BalloonTipText = CopiedToClipBoardToolTip; this.notifyIcon1.ShowBalloonTip(200); PrintDocument pd = new PrintDocument(); pd.PrintPage += new PrintPageEventHandler(PrintImage); PrintDialog pdi = new PrintDialog(); pdi.Document = pd; pdi.UseEXDialog = true; if (pdi.ShowDialog() == DialogResult.OK) { pd.Print(); } else { MessageBox.Show("Print Cancelled"); } */ } }