public void Draw(XGraphics gfx) { TransformsProvider tp = new TransformsProvider(gfx); XRect rect = tp.FromCmsToPts(new XRect(_Left, _Top, _Width, _Height)); if (this._fillColorName == Color.Transparent.Name) { gfx.DrawRectangle(new XPen(XColor.FromName(_lineColorName), _lineWidth), rect); } else { gfx.DrawRectangle(new XPen(XColor.FromName(_lineColorName), _lineWidth), new XSolidBrush(XColor.FromName(_fillColorName)), rect); } }
public void Draw(XGraphics gfx) { TransformsProvider tp = new TransformsProvider(gfx); XFont font = new XFont(this._fontFamilyName, this._fontSize, this._fontStyle); XSolidBrush brush = new XSolidBrush(XColor.FromName(this._fontColorName)); if (this._rect == XRect.Empty) { double x = tp.CmsToPts(this._x); double y = tp.CmsToPts(this._y); gfx.DrawString(this._text, font, brush, x, y, XStringFormat.TopLeft); } else { XRect rect = tp.FromCmsToPts(this._rect); gfx.DrawString(this._text, font, brush, rect, this._format); } }
public new void Draw(XGraphics gfx) { TransformsProvider tp = new TransformsProvider(gfx); XFont font = new XFont(this.FontFamilyName, this.FontSize, this.FontStyle); XSolidBrush brush = new XSolidBrush(XColor.FromName(this.FontColorName)); string txt = string.Format("{0} {1}", this._prefix, DateTime.Today.ToShortDateString()); if (base.Rect == XRect.Empty) { double x = tp.CmsToPts(this.X); double y = tp.CmsToPts(this.Y); gfx.DrawString(txt, font, brush, x, y, XStringFormat.TopLeft); } else { XRect rect = tp.FromCmsToPts(base.Rect); gfx.DrawString(txt, font, brush, rect, base.Format); } }
public void Draw(XGraphics gfx) { TransformsProvider tp = new TransformsProvider(gfx); if (this._rect != XRect.Empty) { XRect rect = tp.FromCmsToPts(this._rect); //Margen de seguridad del 5% rect.Inflate(-((5 * rect.Width) / 100), -((5 * rect.Height) / 100)); try { System.IO.Stream imgStream = this.GetType().Assembly.GetManifestResourceStream(this._rscName); Image img = Image.FromStream(imgStream); gfx.DrawImage(XImage.FromGdiPlusImage(img), rect); imgStream.Close(); } catch { //Do nothing } } }
public void Draw(XGraphics gfx, object param) { TransformsProvider tp = new TransformsProvider(gfx); XFont font = new XFont(this.FontFamilyName, this.FontSize, this.FontStyle); XSolidBrush brush = new XSolidBrush(XColor.FromName(this.FontColorName)); string s = string.Empty; if (param is DBNull) { s = string.Format("{0} {1} {2}", this._prefix, string.Empty, this._subfix); } if (param is string) { switch (_bindPropertyFormat) { case ValueParsingOption.None: s = string.Format("{0} {1} {2}", this._prefix, param, this._subfix).Trim(); break; case ValueParsingOption.ParseInteger: int intVal; if (int.TryParse((string)param, out intVal)) { s = string.Format("{0} {1} {2}", this._prefix, intVal.ToString("#,###"), this._subfix).Trim(); } else { s = string.Format("{0} {1} {2}", this._prefix, param, this._subfix).Trim(); } break; case ValueParsingOption.ParseFloat: double floatVal; CultureInfo culture = null; try { culture = CultureInfo.GetCultureInfo(this._bindPropertyCultureName); } catch { //Do nothing } if (culture == null) { s = string.Format("{0} {1} {2}", this._prefix, param, this._subfix).Trim(); } else { if (double.TryParse((string)param, NumberStyles.AllowDecimalPoint | NumberStyles.AllowThousands, culture, out floatVal)) { s = string.Format("{0} {1} {2}", this._prefix, floatVal.ToString("#,###.##"), this._subfix).Trim(); } else { s = string.Format("{0} {1} {2}", this._prefix, param, this._subfix).Trim(); } } break; } } if (param is int) { int intVal = (int)param; s = string.Format("{0} {1} {2}", this._prefix, (intVal).ToString("#,###"), this._subfix).Trim(); } if ((param is double) || (param is float)) { double floatVal = (double)param; s = string.Format("{0} {1} {2}", this._prefix, floatVal.ToString("#,###.##"), this._subfix).Trim(); } if (base.Rect == XRect.Empty) { double x = tp.CmsToPts(this.X); double y = tp.CmsToPts(this.Y); gfx.DrawString(s, font, brush, x, y, XStringFormat.TopLeft); } else { XRect rect = tp.FromCmsToPts(base.Rect); gfx.DrawString(s, font, brush, rect, base.Format); } }
public void Draw(XGraphics gfx, Map map) { TransformsProvider tp = new TransformsProvider(gfx); XRect rect = tp.FromCmsToPts(new XRect(this.Left, this.Top, this.Width, this.Height)); double geomScaleFactor; geomScaleFactor = tp.WorldToPaperScale(map.GetExtents(), rect); XRect geomFrame = tp.WorldToPaperRect(map.GetExtents(), rect); XGraphicsState state = gfx.Save(); gfx.TranslateTransform(geomFrame.X, geomFrame.Bottom); if (this._cacheIsEmpty) { foreach (Layer lyr in map.Layers) { if ((lyr) is VectorLayer) { if (this._overrideVectorLayerStyle) { this.DrawVectorLayer(gfx, map, geomScaleFactor, (VectorLayer)lyr, this._geomLineColorName, this._geomLineWidth, this._geomFillColorName); } else { if ((lyr as VectorLayer).Theme == null) { this.DrawVectorLayer(gfx, map, geomScaleFactor, (VectorLayer)lyr); } else { this.DrawThemeLayer(gfx, map, geomScaleFactor, (VectorLayer)lyr); } } } if (lyr is LabelLayer) { if (this._overrideLabelLayerStyle) { this.DrawLabelLayer(gfx, map, geomScaleFactor, (LabelLayer)lyr, _labelFontFamilyName, _labelFontSize, _labelFontStyle, _labelFontColorName); } else { LabelStyle simb = (lyr as LabelLayer).Style; this.DrawLabelLayer(gfx, map, geomScaleFactor, (LabelLayer)lyr, simb.Font.FontFamily.Name, simb.Font.Size, (XFontStyle)simb.Font.Style, simb.ForeColor.Name); } } } this._cacheIsEmpty = false; } else { foreach (PDFGeom g in this._geomCache) { if (g.FillStyle == null) { gfx.DrawPath(g.LineStyle, g.Geometry); } else if (g.LineStyle == null) { gfx.DrawPath(g.FillStyle, g.Geometry); } else { gfx.DrawPath(g.LineStyle, g.FillStyle, g.Geometry); } } foreach (PDFLabel l in this._labelCache) { gfx.DrawString(l.Text, l.Font, l.Brush, l.Point, XStringFormat.Center); } } gfx.Restore(state); _scale.Draw(gfx, geomScaleFactor); _geomarks.Draw(gfx, map.GetExtents(), rect); }