public void DrawAttribute(Graphics g, YYS.Parser.Attribute attr, int x1, int y1, int x2, int y2) { if ((attr.type & AttrType.UnderLine) == AttrType.UnderLine || (attr.type & AttrType.Link) == AttrType.Link) { AttributeLinePen.Color = attr.color; g.DrawLine(AttributeLinePen, x1, y1 + H(), x2, y2 + H()); } if ((attr.type & AttrType.Strike) == AttrType.Strike) { AttributeLinePen.Color = attr.color; g.DrawLine(AttributeLinePen, x1, y1 + H() * 2 / 3, x2, y2 + H() * 2 / 3); } }
//private TextFormatFlags textFlags = TextFormatFlags.Left | TextFormatFlags.WordBreak | TextFormatFlags.Internal | TextFormatFlags.NoClipping | TextFormatFlags.NoPrefix; public void DrawText(Graphics g, string text, YYS.Parser.Attribute attr, int X, int Y) { if ((attr.type & AttrType.Bold) == AttrType.Bold) { //TextRenderer.DrawText(g, // text, // this.BoldFont, // new Point(X, Y), // attr.color, // textFlags); //StringFormat sf = new StringFormat(StringFormat.GenericTypographic); //sf.FormatFlags = StringFormatFlags.NoWrap; ////var s = BoldFont.SizeInPoints * (96 / 72) * 0.17; ////var pf = new PointF((float)(X), (float)Y); //g.DrawString(text, this.Font, lineNumberBrush, new PointF(X, Y), sf); //g.DrawString(text, this.Font, lineNumberBrush, new PointF((float)(X + 1), (float)(Y)), sf); TextRenderer.DrawText(g, text, this.Font, new Point(X, Y), attr.color, textFlags); TextRenderer.DrawText(g, text, this.Font, new Point(X + 1, Y), attr.color, textFlags); } else { TextRenderer.DrawText(g, text, this.Font, new Point(X, Y), attr.color, textFlags); } }