Exemplo n.º 1
0
        private Color GetCustomColor(MapCustomColor mapCustomColor)
        {
            ReportColorProperty color = mapCustomColor.Color;
            Color color2 = Color.Empty;

            if (color != null)
            {
                if (MappingHelper.GetColorFromReportColorProperty(color, ref color2))
                {
                    return(color2);
                }
                ReportColor color3 = mapCustomColor.Instance.Color;
                if (color3 != null)
                {
                    return(color3.ToColor());
                }
            }
            return(color2);
        }
        internal Font GetFont(Style style, StyleInstance styleInstance, bool hasScope)
        {
            if (style == null)
            {
                return(m_mapMapper.GetDefaultFontFromCache(0));
            }
            string text = MappingHelper.DefaultFontFamily;

            if (m_mapMapper.GetDefaultFont() != null)
            {
                text = m_mapMapper.GetDefaultFont().Name;
            }
            if (!MappingHelper.IsPropertyExpression(style.FontFamily) || hasScope)
            {
                text = MappingHelper.GetStyleFontFamily(style, styleInstance, text);
            }
            float           fontSize       = (!(!MappingHelper.IsPropertyExpression(style.FontSize) || hasScope)) ? MappingHelper.DefaultFontSize : MappingHelper.GetStyleFontSize(style, styleInstance);
            FontStyles      fontStyle      = (!(!MappingHelper.IsPropertyExpression(style.FontStyle) || hasScope)) ? FontStyles.Normal : MappingHelper.GetStyleFontStyle(style, styleInstance);
            FontWeights     fontWeight     = (!(!MappingHelper.IsPropertyExpression(style.FontWeight) || hasScope)) ? FontWeights.Normal : MappingHelper.GetStyleFontWeight(style, styleInstance);
            TextDecorations textDecoration = (!(!MappingHelper.IsPropertyExpression(style.TextDecoration) || hasScope)) ? TextDecorations.None : MappingHelper.GetStyleFontTextDecoration(style, styleInstance);

            return(m_mapMapper.GetFontFromCache(0, text, fontSize, fontStyle, fontWeight, textDecoration));
        }
Exemplo n.º 3
0
 internal static int GetDefaultSize(float dpi)
 {
     return(MappingHelper.ToIntPixels(m_defaultLineWidth, dpi));
 }
 internal static int GetDefaultSymbolSize(float dpi)
 {
     return(MappingHelper.ToIntPixels(m_defaultSymbolSize, dpi));
 }
Exemplo n.º 5
0
 protected Font GetFont(Style style, StyleInstance styleInstance)
 {
     return(m_fontCache.GetFont(MappingHelper.GetStyleFontFamily(style, styleInstance, GetDefaultFont().Name), MappingHelper.GetStyleFontSize(style, styleInstance), MappingHelper.GetStyleFontStyle(MappingHelper.GetStyleFontStyle(style, styleInstance), MappingHelper.GetStyleFontWeight(style, styleInstance), MappingHelper.GetStyleFontTextDecoration(style, styleInstance))));
 }
Exemplo n.º 6
0
 internal Font GetFontFromCache(int id, Style style, StyleInstance styleInstance)
 {
     return(GetFontFromCache(id, MappingHelper.GetStyleFontFamily(style, styleInstance, GetDefaultFont().Name), MappingHelper.GetStyleFontSize(style, styleInstance), MappingHelper.GetStyleFontStyle(style, styleInstance), MappingHelper.GetStyleFontWeight(style, styleInstance), MappingHelper.GetStyleFontTextDecoration(style, styleInstance)));
 }
Exemplo n.º 7
0
 internal Font GetFontFromCache(int id, string fontFamily, float fontSize, FontStyles fontStyle, FontWeights fontWeight, TextDecorations textDecoration)
 {
     return(m_fontCache.GetFontFromCache(id, fontFamily, fontSize, MappingHelper.GetStyleFontStyle(fontStyle, fontWeight, textDecoration)));
 }
Exemplo n.º 8
0
 public Font GetDefaultFont()
 {
     return(GetFont(m_defaultFontFamily, m_defaultFontSize, MappingHelper.GetStyleFontStyle(FontStyles.Normal, FontWeights.Normal, TextDecorations.None)));
 }
Exemplo n.º 9
0
        internal static MemoryStream CreateExceptionImage(Exception exception, int width, int height, float dpiX, float dpiY)
        {
            Bitmap       bitmap       = null;
            Graphics     graphics     = null;
            Brush        brush        = null;
            Brush        brush2       = null;
            Pen          pen          = null;
            Pen          pen2         = null;
            Font         font         = null;
            MemoryStream memoryStream = new MemoryStream();

            try
            {
                bitmap = new Bitmap(width, height);
                bitmap.SetResolution(dpiX, dpiY);
                graphics = Graphics.FromImage(bitmap);
                brush    = new SolidBrush(Color.White);
                graphics.FillRectangle(brush, 0, 0, width, height);
                float num  = (float)MappingHelper.ToPixels(new ReportSize("1pt"), dpiX);
                float num2 = (float)MappingHelper.ToPixels(new ReportSize("1pt"), dpiY);
                pen  = new Pen(Color.Black, num);
                pen2 = new Pen(Color.Black, num2);
                graphics.DrawLine(pen, num, num2, (float)width - num, num2);
                graphics.DrawLine(pen2, (float)width - num, num2, (float)width - num, (float)height - num2);
                graphics.DrawLine(pen, (float)width - num, (float)height - num2, num, (float)height - num2);
                graphics.DrawLine(pen2, num, (float)height - num2, num, num2);
                brush2 = new SolidBrush(Color.Black);
                font   = MappingHelper.GetDefaultFont();
                graphics.DrawString(GetInnerMostException(exception).Message, font, brush2, new RectangleF(num, num2, (float)width - num, (float)height - num2));
                bitmap.Save(memoryStream, ImageFormat.Png);
                return(memoryStream);
            }
            catch (Exception ex)
            {
                if (AsynchronousExceptionDetection.IsStoppingException(ex))
                {
                    throw;
                }
                Global.Tracer.Trace(TraceLevel.Verbose, ex.Message);
                return(null);
            }
            finally
            {
                if (brush != null)
                {
                    brush.Dispose();
                    brush = null;
                }
                if (pen != null)
                {
                    pen.Dispose();
                    pen = null;
                }
                if (pen2 != null)
                {
                    pen2.Dispose();
                    pen2 = null;
                }
                if (brush2 != null)
                {
                    brush2.Dispose();
                    brush2 = null;
                }
                if (font != null)
                {
                    font.Dispose();
                    font = null;
                }
                if (graphics != null)
                {
                    graphics.Dispose();
                    graphics = null;
                }
                if (bitmap != null)
                {
                    bitmap.Dispose();
                    bitmap = null;
                }
            }
        }