public Rectangle MeasureText(string text) { // Get the resource cache because the Font is needed Canguro.View.ResourceManager rc = GraphicViewManager.Instance.ResourceManager; // Get bounding rectangle return(rc.LabelFont.MeasureString(null, text, DrawTextFormat.Left, GraphicViewManager.Instance.PrintingHiResImage ? Color.Black : Color.White)); }
/// <summary> /// Paint some text over the active viewport at the indicated position and color /// </summary> /// <param name="text"> A string containing the text to show </param> /// <param name="pos"> Position in world coordinates where text muts be displayed </param> /// <param name="color"> Color for the text </param> public void DrawText(string text, Rectangle rect, System.Drawing.Color color) { // Get the resource cache because the Font is needed Canguro.View.ResourceManager rc = GraphicViewManager.Instance.ResourceManager; // Check if Font object has a valid value if (rc.LabelFont != null && !rc.LabelFont.Disposed) { rc.LabelFont.DrawText(null, text, rect, DrawTextFormat.Left, color); // Draw text on the screen } }