示例#1
0
        public virtual void PrintPreview()
        {
            if (_view == null)
            {
                throw new PrintDocumentException("A Diagram reference was not set for this PrintDocument.");
            }

            System.Windows.Forms.PrintPreviewDialog objDialog = new System.Windows.Forms.PrintPreviewDialog();
            objDialog.Document = this;

            //Set the zoom
            _render.Zoom = _view.Zoom;

            objDialog.ShowDialog();
            objDialog.Dispose();
        }
        public virtual void PrintPreview(Point Location, Size Size)
        {
            if (mDiagram == null)
            {
                throw new PrintDocumentException("A Diagram reference was not set for this PrintDocument.");
            }

            System.Windows.Forms.PrintPreviewDialog objDialog = new System.Windows.Forms.PrintPreviewDialog();
            objDialog.Document = this;
            objDialog.Location = Location;
            objDialog.Size     = Size;

            //Set the zoom
            mRender.Zoom = mDiagram.Zoom;

            objDialog.ShowDialog();
            objDialog.Dispose();
        }
示例#3
0
 /// <summary>
 /// Handler for the menu item "File" - "Print Preview".
 /// </summary>
 /// <param name="sender">Not used.</param>
 /// <param name="e">Not used.</param>
 private void EhMenuFilePrintPreview_OnClick(object sender, System.EventArgs e)
 {
     try
     {
         System.Windows.Forms.PrintPreviewDialog dlg = new System.Windows.Forms.PrintPreviewDialog();
         Current.PrintingService.PrintDocument.PrintPage += new System.Drawing.Printing.PrintPageEventHandler(this.EhPrintPage);
         dlg.Document = Current.PrintingService.PrintDocument;
         dlg.ShowDialog(this.m_View.Window);
         dlg.Dispose();
     }
     catch (Exception ex)
     {
         System.Windows.Forms.MessageBox.Show(this.m_View.Window, ex.ToString());
     }
     finally
     {
         Current.PrintingService.PrintDocument.PrintPage -= new System.Drawing.Printing.PrintPageEventHandler(this.EhPrintPage);
     }
 }
示例#4
0
		/// <summary>
		/// Handler for the menu item "File" - "Print Preview".
		/// </summary>
		/// <param name="sender">Not used.</param>
		/// <param name="e">Not used.</param>
		private void EhMenuFilePrintPreview_OnClick(object sender, System.EventArgs e)
		{
			try
			{
				System.Windows.Forms.PrintPreviewDialog dlg = new System.Windows.Forms.PrintPreviewDialog();
				Current.PrintingService.PrintDocument.PrintPage += new System.Drawing.Printing.PrintPageEventHandler(this.EhPrintPage);
				dlg.Document = Current.PrintingService.PrintDocument;
				dlg.ShowDialog(this.m_View.Window);
				dlg.Dispose();
			}
			catch (Exception ex)
			{
				System.Windows.Forms.MessageBox.Show(this.m_View.Window, ex.ToString());
			}
			finally
			{
				Current.PrintingService.PrintDocument.PrintPage -= new System.Drawing.Printing.PrintPageEventHandler(this.EhPrintPage);
			}
		}
		public virtual void PrintPreview(Point Location, Size Size)
		{
			if (mDiagram == null) throw new PrintDocumentException("A Diagram reference was not set for this PrintDocument.");

			System.Windows.Forms.PrintPreviewDialog objDialog = new System.Windows.Forms.PrintPreviewDialog();
			objDialog.Document = this;
			objDialog.Location = Location;
			objDialog.Size = Size;

			//Set the zoom
			mRender.Zoom = mDiagram.Zoom;

			objDialog.ShowDialog();
			objDialog.Dispose();
		}