public override void DrawTextForAllNodes(Graphics oGraphics, Rectangle oTreemapRectangle, Nodes oNodes) { Debug.Assert(oGraphics != null); Debug.Assert(oNodes != null); this.AssertValid(); IFontMapper fontMapper = null; TransparentBrushMapper transparentBrushMapper = null; TextRenderingHint textRenderingHint = oGraphics.TextRenderingHint; try { fontMapper = this.CreateFontMapper(oGraphics); transparentBrushMapper = this.CreateTransparentBrushMapper(); StringFormat oStringFormat = this.CreateStringFormat(); this.DrawTextForNodes(oNodes, oGraphics, fontMapper, oStringFormat, transparentBrushMapper, 0); } finally { if (fontMapper != null) { fontMapper.Dispose(); } if (transparentBrushMapper != null) { transparentBrushMapper.Dispose(); } oGraphics.TextRenderingHint = textRenderingHint; } }
public override void DrawTextForSelectedNode(Graphics oGraphics, Node oSelectedNode) { Debug.Assert(oGraphics != null); Debug.Assert(oSelectedNode != null); this.AssertValid(); IFontMapper fontMapper = null; Brush brush = null; TextRenderingHint textRenderingHint = TextRenderingHint.SystemDefault; try { fontMapper = this.CreateFontMapper(oGraphics); brush = new SolidBrush(this.m_oSelectedFontColor); Font font; string s; if (fontMapper.NodeToFont(oSelectedNode, oSelectedNode.Level, oGraphics, out font, out s)) { textRenderingHint = base.SetTextRenderingHint(oGraphics, font); StringFormat format = this.CreateStringFormat(); oGraphics.DrawString(s, font, brush, oSelectedNode.Rectangle, format); } } finally { if (fontMapper != null) { fontMapper.Dispose(); } if (brush != null) { brush.Dispose(); } oGraphics.TextRenderingHint = textRenderingHint; } }
public override void DrawTextForSelectedNode(Graphics oGraphics, Node oSelectedNode) { Debug.Assert(oGraphics != null); Debug.Assert(oSelectedNode != null); AssertValid(); IFontMapper fontMapper = null; Brush brush = null; TextRenderingHint textRenderingHint = TextRenderingHint.SystemDefault; try { fontMapper = CreateFontMapper(oGraphics); brush = new SolidBrush(m_oSelectedFontColor); if (fontMapper.NodeToFont(oSelectedNode, oSelectedNode.Level, oGraphics, out Font oFont, out string sTextToDraw)) { textRenderingHint = SetTextRenderingHint(oGraphics, oFont); StringFormat format = CreateStringFormat(); oGraphics.DrawString(sTextToDraw, oFont, brush, oSelectedNode.Rectangle, format); } } finally { fontMapper?.Dispose(); brush?.Dispose(); oGraphics.TextRenderingHint = textRenderingHint; } }