/// <summary> /// Assigns new text to the object. The text is formatted /// according to the specified font and graphics objects. /// </summary> public void Setup(string text, Graphics graphics, Font font) { _text = text; // Process the text _words.Clear(); ProcessText(); // Update the read-only words collection _readOnlyWords = new WordList(_words); // Recalculates the width of all words within the text, // using the specified font and graphics objects foreach (Word word in _words) { word.UpdateMeasures(graphics, font); } // Calculate the height of the text when // drawn with the specified font in the specified graphics _height = font.GetHeight(graphics); }
/// <summary> /// Assigns new text to the object. The text is formatted /// according to the specified font and graphics objects. /// </summary> public void Setup(string text, Graphics graphics, Font font) { _text = text; // Process the text _words.Clear(); ProcessText(); // Update the read-only words collection _readOnlyWords = new WordList(_words); // Recalculates the width of all words within the text, // using the specified font and graphics objects foreach (Word word in _words) word.UpdateMeasures(graphics, font); // Calculate the height of the text when // drawn with the specified font in the specified graphics _height = font.GetHeight(graphics); }
public Text() { _text = ""; _words = new ArrayList(256); _readOnlyWords = new WordList(_words); _height = 0; }