private double GetStartSize() { MapSizeRule mapSizeRule = (MapSizeRule)base.m_mapRule; ReportSizeProperty startSize = mapSizeRule.StartSize; ReportSize size = startSize.IsExpression ? mapSizeRule.Instance.StartSize : startSize.Value; return(MappingHelper.ToPixels(size, base.m_mapMapper.DpiX)); }
public static int ToIntPixels(double value, Unit unit, float dpi) { return(Convert.ToInt32(MappingHelper.ToPixels(value, unit, dpi))); }
public 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(DynamicImageInstance.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; } } }
public static int ToIntPixels(ReportSize size, float dpi) { return(Convert.ToInt32(MappingHelper.ToPixels(size, dpi))); }