示例#1
0
 private void SetupGraphics(float dpi)
 {
     this.m_graphics.PageUnit  = GraphicsUnit.Pixel;
     this.m_graphics.PageScale = 1f;
     this.m_hdc      = new Win32DCSafeHandle(this.m_graphics.GetHdc(), false);
     this.m_oldXForm = default(Win32.XFORM);
     if (this.m_matrix != null)
     {
         this.m_xForm   = new Win32.XFORM(this.m_matrix, this.m_pageUnits, dpi);
         this.m_oldMode = Win32.SetGraphicsMode(this.m_hdc, 2);
         if (!Win32.GetWorldTransform(this.m_hdc, ref this.m_oldXForm))
         {
             Marshal.ThrowExceptionForHR(Marshal.GetHRForLastWin32Error());
         }
         if (!Win32.SetWorldTransform(this.m_hdc, ref this.m_xForm))
         {
             Marshal.ThrowExceptionForHR(Marshal.GetHRForLastWin32Error());
         }
     }
     else
     {
         this.m_xForm = Win32.XFORM.Identity;
     }
 }