SEP2007 wrote:But if the rich text box has a font object *as part of it* (?)
I.e. it uses a font object within its make-up
Why can't I access that ?
But you can access it, the RichTextBox.Font property has both a getter and a setter. However, if memory doesn't fail me, the Font class is immutable--you can't change the Font object's fields. So you can't just set Font.FontFamily. You have to create a new instance of Font and set that on the RichTextBox. That's a feature of Font, not RichTextBox.
This probably works out well for RichTextBox, as it would like to know when the font changes, so forcing you to use a setter makes it clear when the font changed. Hypothetically,
class RichTextBox
{
Font Font
{
set
{
// Ah, we're changing the font!
_font = value;
InvalidateLayout(); // Force a layout and redraw.
}
get
{
return _font;
}
}
}
Or some such thing.