Esempio n. 1
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        ///
        /// </summary>
        /// <param name="e"></param>
        /// ------------------------------------------------------------------------------------
        private void Init(PrintPageEventArgs e)
        {
#if false
            long x1 = System.DateTime.Now.Ticks;
#endif
            // Set these now because the Graphics object will be locked below.
            m_rcDst         = m_rcSrc = new Rect(0, 0, (int)e.Graphics.DpiX, (int)e.Graphics.DpiY);
            m_dxpAvailWidth = PixelsFrom100ths(e.MarginBounds.Width, (int)e.Graphics.DpiX);

            // Create and initialize a print context.
            m_vwPrintContext = VwPrintContextWin32Class.Create();

            // TODO: When we provide a way for the user to specify the nFirstPageNo (i.e. the
            // first argument to SetPagePrintInfo), then change the arguments to
            // SetPagePrintInfo.
            m_vwPrintContext.SetPagePrintInfo(1, 1, 65535, 1, false);
            SetMargins(e);

            IVwGraphics vwGraphics = VwGraphicsWin32Class.Create();
            IntPtr      hdc        = IntPtr.Zero;
            try
            {
                // Get the printer's hdc and use it to initialize other stuff.
                hdc = e.Graphics.GetHdc();
                ((IVwGraphicsWin32)vwGraphics).Initialize(hdc);
                m_vwPrintContext.SetGraphics(vwGraphics);

                // Make a rootbox for printing and initialize it.
                m_rootb = VwRootBoxClass.Create();
                m_rootb.SetSite(this);
                m_rootb.DataAccess = m_sda;
                m_rootb.SetRootObject(m_hvo, m_vc, m_frags, m_styleSheet);
                m_rootb.InitializePrinting(m_vwPrintContext);
                m_totalNumberOfPages = m_rootb.GetTotalPrintPages(m_vwPrintContext, null);
                m_psettings          = e.PageSettings.PrinterSettings;
                SetPrintRange();
            }
            catch
            {
                m_rootb = null;
                string errorMsg =
                    ResourceHelper.GetResourceString("kstidErrorCreatingPrintRootSite");

                // TODO: Add the help file and url when we have a help file.
                MessageBox.Show(errorMsg, "", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                if (hdc != IntPtr.Zero)
                {
                    vwGraphics.ReleaseDC();
                    e.Graphics.ReleaseHdc(hdc);
                }
            }
#if false
            long x2 = System.DateTime.Now.Ticks;
            Debug.WriteLine("PrintRootSite.Init() took " + DeltaTime(x1, x2) + " seconds.");
#endif
        }
Esempio n. 2
0
        private void Init(PrintPageEventArgs e)
        {
#if false
            long x1 = System.DateTime.Now.Ticks;
#endif
            // Set these now because the Graphics object will be locked below.
            m_rcDst = m_rcSrc = new Rect(0, 0, (int)e.Graphics.DpiX, (int)e.Graphics.DpiY);

            int dpix;
            if (MiscUtils.IsUnix)
            {
                dpix = 72;
            }
            else
            {
                dpix = (int)e.Graphics.DpiX;
            }

            m_dxpAvailWidth = PixelsFrom100ths(e.MarginBounds.Width, dpix);

            // Create and initialize a print context.
            m_vwPrintContext = VwPrintContextWin32Class.Create();

            // TODO: When we provide a way for the user to specify the nFirstPageNo (i.e. the
            // first argument to SetPagePrintInfo), then change the arguments to
            // SetPagePrintInfo.
            m_vwPrintContext.SetPagePrintInfo(1, 1, 65535, 1, false);
            SetMargins(e);

            IVwGraphics vwGraphics = VwGraphicsWin32Class.Create();
            IntPtr      hdc        = IntPtr.Zero;
            try
            {
                // Get the printer's hdc and use it to initialize other stuff.
                hdc = e.Graphics.GetHdc();
                ((IVwGraphicsWin32)vwGraphics).Initialize(hdc);
                m_vwPrintContext.SetGraphics(vwGraphics);

                // Make a rootbox for printing and initialize it.
                m_rootb = VwRootBoxClass.Create();
                m_rootb.SetSite(this);
                m_rootb.DataAccess = m_sda;
                m_rootb.SetRootObject(m_hvo, m_vc, m_frags, m_styleSheet);
                m_rootb.InitializePrinting(m_vwPrintContext);
                m_totalNumberOfPages = m_rootb.GetTotalPrintPages(m_vwPrintContext);
                m_psettings          = e.PageSettings.PrinterSettings;
                SetPrintRange();
            }
            catch (Exception ex)
            {
                m_rootb = null;

                throw new ContinuableErrorException("An error has occurred during the setup required for printing.", ex);
            }
            finally
            {
                if (hdc != IntPtr.Zero)
                {
                    vwGraphics.ReleaseDC();
                    e.Graphics.ReleaseHdc(hdc);
                }
            }
#if false
            long x2 = System.DateTime.Now.Ticks;
            Debug.WriteLine("PrintRootSite.Init() took " + DeltaTime(x1, x2) + " seconds.");
#endif
        }
Esempio n. 3
0
 public void PrintSinglePage(IVwPrintContext _vpc, int nPageNo)
 {
     throw new NotImplementedException("The method or operation is not implemented.");
 }
Esempio n. 4
0
 public int GetTotalPrintPages(IVwPrintContext _vpc)
 {
     throw new NotImplementedException("The method or operation is not implemented.");
 }
Esempio n. 5
0
 public void InitializePrinting(IVwPrintContext _vpc)
 {
     throw new NotImplementedException("The method or operation is not implemented.");
 }
		public void PrintSinglePage(IVwPrintContext _vpc, int nPageNo)
		{
			throw new NotImplementedException();
		}
		public int GetTotalPrintPages(IVwPrintContext _vpc, IAdvInd3 _advi3)
		{
			throw new Exception("The method or operation is not implemented.");
		}
Esempio n. 8
0
 /// <summary/>
 public void InitializePrinting(IVwPrintContext _vpc)
 {
     throw new NotImplementedException();
 }
Esempio n. 9
0
 /// <summary/>
 public int GetTotalPrintPages(IVwPrintContext _vpc)
 {
     throw new NotImplementedException();
 }
Esempio n. 10
0
 public int GetTotalPrintPages(IVwPrintContext _vpc, IAdvInd3 _advi3)
 {
     throw new Exception("The method or operation is not implemented.");
 }
Esempio n. 11
0
 public void Print(IVwPrintContext _vpc, IAdvInd3 _advi3)
 {
     throw new Exception("The method or operation is not implemented.");
 }
Esempio n. 12
0
		public void PrintSinglePage(IVwPrintContext _vpc, int nPageNo)
		{
			throw new Exception("The method or operation is not implemented.");
		}
Esempio n. 13
0
		public void Print(IVwPrintContext _vpc, IAdvInd3 _advi3)
		{
			throw new Exception("The method or operation is not implemented.");
		}
Esempio n. 14
0
		public void InitializePrinting(IVwPrintContext _vpc)
		{
			throw new Exception("The method or operation is not implemented.");
		}
		public void InitializePrinting(IVwPrintContext _vpc)
		{
			throw new NotImplementedException();
		}
Esempio n. 16
0
 /// <summary/>
 public void PrintSinglePage(IVwPrintContext _vpc, int nPageNo)
 {
     throw new NotImplementedException();
 }
		public int GetTotalPrintPages(IVwPrintContext _vpc)
		{
			throw new NotImplementedException();
		}
Esempio n. 18
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		///
		/// </summary>
		/// <param name="e"></param>
		/// ------------------------------------------------------------------------------------
		private void Init(PrintPageEventArgs e)
		{
#if false
			long x1 = System.DateTime.Now.Ticks;
#endif
			// Set these now because the Graphics object will be locked below.
			m_rcDst = m_rcSrc = new Rect(0, 0, (int)e.Graphics.DpiX, (int)e.Graphics.DpiY);
			m_dxpAvailWidth = PixelsFrom100ths(e.MarginBounds.Width, (int)e.Graphics.DpiX);

			// Create and initialize a print context.
			m_vwPrintContext = VwPrintContextWin32Class.Create();

			// TODO: When we provide a way for the user to specify the nFirstPageNo (i.e. the
			// first argument to SetPagePrintInfo), then change the arguments to
			// SetPagePrintInfo.
			m_vwPrintContext.SetPagePrintInfo(1, 1, 65535, 1, false);
			SetMargins(e);

			IVwGraphics vwGraphics = VwGraphicsWin32Class.Create();
			IntPtr hdc = IntPtr.Zero;
			try
			{
				// Get the printer's hdc and use it to initialize other stuff.
				hdc = e.Graphics.GetHdc();
				((IVwGraphicsWin32)vwGraphics).Initialize(hdc);
				m_vwPrintContext.SetGraphics(vwGraphics);

				// Make a rootbox for printing and initialize it.
				m_rootb = VwRootBoxClass.Create();
				m_rootb.SetSite(this);
				m_rootb.DataAccess = m_sda;
				m_rootb.SetRootObject(m_hvo, m_vc, m_frags, m_styleSheet);
				m_rootb.InitializePrinting(m_vwPrintContext);
				m_totalNumberOfPages = m_rootb.GetTotalPrintPages(m_vwPrintContext, null);
				m_psettings = e.PageSettings.PrinterSettings;
				SetPrintRange();
			}
			catch
			{
				m_rootb = null;
				string errorMsg =
					ResourceHelper.GetResourceString("kstidErrorCreatingPrintRootSite");

				// TODO: Add the help file and url when we have a help file.
				MessageBox.Show(errorMsg, "", MessageBoxButtons.OK, MessageBoxIcon.Error);
			}
			finally
			{
				if (hdc != IntPtr.Zero)
				{
					vwGraphics.ReleaseDC();
					e.Graphics.ReleaseHdc(hdc);
				}
			}
#if false
			long x2 = System.DateTime.Now.Ticks;
			Debug.WriteLine("PrintRootSite.Init() took " + DeltaTime(x1,x2) + " seconds.");
#endif
		}
Esempio n. 19
0
		private void Init(PrintPageEventArgs e)
		{
#if false
			long x1 = System.DateTime.Now.Ticks;
#endif
			// Set these now because the Graphics object will be locked below.
			m_rcDst = m_rcSrc = new Rect(0, 0, (int)e.Graphics.DpiX, (int)e.Graphics.DpiY);

			int dpix;
			if (MiscUtils.IsUnix)
				dpix = 72;
			else
				dpix = (int)e.Graphics.DpiX;

			m_dxpAvailWidth = PixelsFrom100ths(e.MarginBounds.Width, dpix);

			// Create and initialize a print context.
			m_vwPrintContext = VwPrintContextWin32Class.Create();

			// TODO: When we provide a way for the user to specify the nFirstPageNo (i.e. the
			// first argument to SetPagePrintInfo), then change the arguments to
			// SetPagePrintInfo.
			m_vwPrintContext.SetPagePrintInfo(1, 1, 65535, 1, false);
			SetMargins(e);

			IVwGraphics vwGraphics = VwGraphicsWin32Class.Create();
			IntPtr hdc = IntPtr.Zero;
			try
			{
				// Get the printer's hdc and use it to initialize other stuff.
				hdc = e.Graphics.GetHdc();
				((IVwGraphicsWin32)vwGraphics).Initialize(hdc);
				m_vwPrintContext.SetGraphics(vwGraphics);

				// Make a rootbox for printing and initialize it.
				m_rootb = VwRootBoxClass.Create();
				m_rootb.SetSite(this);
				m_rootb.DataAccess = m_sda;
				m_rootb.SetRootObject(m_hvo, m_vc, m_frags, m_styleSheet);
				m_rootb.InitializePrinting(m_vwPrintContext);
				m_totalNumberOfPages = m_rootb.GetTotalPrintPages(m_vwPrintContext);
				m_psettings = e.PageSettings.PrinterSettings;
				SetPrintRange();
			}
			catch (Exception ex)
			{
				m_rootb = null;

				throw new ContinuableErrorException("An error has occurred during the setup required for printing.", ex);
			}
			finally
			{
				if (hdc != IntPtr.Zero)
				{
					vwGraphics.ReleaseDC();
					e.Graphics.ReleaseHdc(hdc);
				}
			}
#if false
			long x2 = System.DateTime.Now.Ticks;
			Debug.WriteLine("PrintRootSite.Init() took " + DeltaTime(x1,x2) + " seconds.");
#endif
		}
		public int GetTotalPrintPages(IVwPrintContext _vpc)
		{
			throw new NotImplementedException("The method or operation is not implemented.");
		}