public bool NodeToFont(Node oNode, int iNodeLevel, Graphics oGraphics, out Font oFont, out string sTextToDraw) { Debug.Assert(oNode != null); Debug.Assert(iNodeLevel >= 0); Debug.Assert(oGraphics != null); this.AssertValid(); bool result; if (iNodeLevel < this.m_oFontForRectangles.Count) { FontForRectangle fontForRectangle = (FontForRectangle)this.m_oFontForRectangles[iNodeLevel]; string text = oNode.Text; if (fontForRectangle.CanFitInRectangle(text, oNode.Rectangle, oGraphics)) { oFont = fontForRectangle.Font; sTextToDraw = text; result = true; return(result); } } oFont = null; sTextToDraw = null; result = false; return(result); }
public bool NodeToFont(Node oNode, int iNodeLevel, Graphics oGraphics, out Font oFont, out string sTextToDraw) { Debug.Assert(oNode != null); Debug.Assert(iNodeLevel >= 0); Debug.Assert(oGraphics != null); this.AssertValid(); string text = oNode.Text; RectangleF rectangle = oNode.Rectangle; IEnumerator enumerator = this.m_oFontForRectangles.GetEnumerator(); bool result; try { while (enumerator.MoveNext()) { FontForRectangle fontForRectangle = (FontForRectangle)enumerator.Current; if (fontForRectangle.CanFitInRectangle(text, rectangle, oGraphics)) { oFont = fontForRectangle.Font; sTextToDraw = text; result = true; return(result); } } } finally { IDisposable disposable = enumerator as IDisposable; if (disposable != null) { disposable.Dispose(); } } oFont = null; sTextToDraw = null; result = false; return(result); }