internal override void BeginPageSection(RectangleF bounds)
        {
            base.BeginPageSection(bounds);
            int dpiX = m_commonGraphics.DpiX;
            int dpiY = m_commonGraphics.DpiY;

            m_bodyRect = new System.Drawing.Rectangle(SharedRenderer.ConvertToPixels(bounds.X, dpiX), SharedRenderer.ConvertToPixels(bounds.Y, dpiY), SharedRenderer.ConvertToPixels(bounds.Width + HalfPixelWidthX, dpiX), SharedRenderer.ConvertToPixels(bounds.Height + HalfPixelWidthY, dpiY));
            m_graphics.ResetClipAndTransform(new RectangleF(bounds.Left, bounds.Top, bounds.Width + HalfPixelWidthX, bounds.Height + HalfPixelWidthY));
        }
        internal override void ClipTextboxRectangle(Win32DCSafeHandle hdc, RectangleF position)
        {
            if (m_bodyRect.X != 0 || m_bodyRect.Y != 0)
            {
                if (!Microsoft.ReportingServices.Rendering.RichText.Win32.GetViewportOrgEx(hdc, out m_prevViewportOrg))
                {
                    int lastWin32Error = Marshal.GetLastWin32Error();
                    throw new Exception(string.Format(CultureInfo.InvariantCulture, ImageRendererRes.Win32ErrorInfo, "GetViewportOrgEx", lastWin32Error));
                }
                if (!Microsoft.ReportingServices.Rendering.RichText.Win32.SetViewportOrgEx(hdc, m_bodyRect.X, m_bodyRect.Y, Win32ObjectSafeHandle.Zero))
                {
                    int lastWin32Error2 = Marshal.GetLastWin32Error();
                    throw new Exception(string.Format(CultureInfo.InvariantCulture, ImageRendererRes.Win32ErrorInfo, "SetViewportOrgEx", lastWin32Error2));
                }
            }
            System.Drawing.Rectangle rectangle = new System.Drawing.Rectangle(SharedRenderer.ConvertToPixels(position.X, m_commonGraphics.DpiX), SharedRenderer.ConvertToPixels(position.Y, m_commonGraphics.DpiY), SharedRenderer.ConvertToPixels(position.Width, m_commonGraphics.DpiX), SharedRenderer.ConvertToPixels(position.Height, m_commonGraphics.DpiY));
            if (position.X < 0f)
            {
                rectangle.Width += rectangle.X;
                rectangle.X      = 0;
            }
            if (position.Y < 0f)
            {
                rectangle.Height += rectangle.Y;
                rectangle.Y       = 0;
            }
            rectangle.X += m_bodyRect.X;
            rectangle.Y += m_bodyRect.Y;
            if (rectangle.Right > m_bodyRect.Right)
            {
                rectangle.Width = m_bodyRect.Right - rectangle.Left;
            }
            if (rectangle.Bottom > m_bodyRect.Bottom)
            {
                rectangle.Height = m_bodyRect.Bottom - rectangle.Top;
            }
            Win32ObjectSafeHandle win32ObjectSafeHandle = Microsoft.ReportingServices.Rendering.RichText.Win32.CreateRectRgn(rectangle.X, rectangle.Y, rectangle.Right, rectangle.Bottom);

            if (win32ObjectSafeHandle.IsInvalid)
            {
                return;
            }
            try
            {
                if (Microsoft.ReportingServices.Rendering.RichText.Win32.SelectClipRgn(hdc, win32ObjectSafeHandle) == 0)
                {
                    int lastWin32Error3 = Marshal.GetLastWin32Error();
                    throw new Exception(string.Format(CultureInfo.InvariantCulture, ImageRendererRes.Win32ErrorInfo, "SelectClipRgn", lastWin32Error3));
                }
            }
            finally
            {
                win32ObjectSafeHandle.Close();
            }
        }
        private RectangleF CalculateMetafileRectangle(IntPtr hdc, float pageWidth, float pageHeight, float DpiX, float DpiY)
        {
            int    deviceCaps  = Microsoft.ReportingServices.Rendering.RichText.Win32.GetDeviceCaps(hdc, 4);
            int    deviceCaps2 = Microsoft.ReportingServices.Rendering.RichText.Win32.GetDeviceCaps(hdc, 6);
            int    deviceCaps3 = Microsoft.ReportingServices.Rendering.RichText.Win32.GetDeviceCaps(hdc, 118);
            int    deviceCaps4 = Microsoft.ReportingServices.Rendering.RichText.Win32.GetDeviceCaps(hdc, 117);
            double num         = SharedRenderer.ConvertToPixels(pageWidth, DpiX);
            double num2        = SharedRenderer.ConvertToPixels(pageHeight, DpiY);
            float  width       = (float)(num * (double)deviceCaps * 100.0) / (float)deviceCaps3;
            float  height      = (float)(num2 * (double)deviceCaps2 * 100.0) / (float)deviceCaps4;

            return(new RectangleF(0f, 0f, width, height));
        }
Esempio n. 4
0
 internal int ConvertToPixels(float mm)
 {
     return(SharedRenderer.ConvertToPixels(mm, m_dpiX));
 }