public TextStyle GetTextStyle() { TextStyle ts = new TextStyle(); ts.font = GetFont(); ts.brush = sbBrush.GetBrush(); ts.stringFormat = GetStringFormat(); if (ts.IsEmpty) { return(null); } if (ts.font == null) { ts.font = GConfig.Instance.styles.font; } if (ts.brush == null) { ts.brush = GConfig.Instance.styles.textBrush; } if (ts.stringFormat == null) { ts.stringFormat = GetDefaultStringFormat(); } return(ts); }
public Pen GetPen() { Pen pen = null; if (sbBrush.Count > 0) { Brush br = sbBrush.GetBrush(); if (br != null) { pen = new Pen(br); } } if (pen == null) { if (HasKey("c")) { Color c = GetColor("c"); if (!c.IsEmpty) { pen = new Pen(c); } } } if (pen != null) { foreach (string key in Keys) { switch (key) { case "w": float w = GetFloat(key); if (!float.IsNaN(w)) { pen.Width = w; } break; case "ds": object dsObj = GetEnum(key, typeof(DashStyle)); if (dsObj != null) { pen.DashStyle = (DashStyle)dsObj; } break; } } } return(pen); }