Initializing FontDialog instance

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

How do I initialize the font parameters when creating an instance of the
FontDialog class? All the properties I'm interested in setting prior to
showing the dialog (Bold, Italic, etc.) have only "get" accessors but no
"set" access.
 
Create a new Font object and assign it to the Font property of the
FontDialog object before you call the ShowDialog method.
 
Lionel said:
How do I initialize the font parameters when creating an instance of the
FontDialog class? All the properties I'm interested in setting prior to
showing the dialog (Bold, Italic, etc.) have only "get" accessors but no
"set" access.

'Font' objects are immutable. Thus you will have to create a new 'Font'
object with the appropriate styles assigned (see overloaded versions of the
constructor).
 
Back
Top