Set Numeric Up Down Font in Runtime

  • Thread starter Thread starter Kalim Julia
  • Start date Start date
K

Kalim Julia

Anybody knows how to set NumericUpDown's font in runtime.
I've tried ....

mlNUMERICUPDOWN.Font.Size = 10
But the system said that Property 'size' is 'ReadOnly'
 
Yes, the *Size* property of the Font object is
read-only, but the *Font* object can be replaced, as in

nud.Font = New Font("Arial", 32, FontStyle.Regular)

Regards,

/JB
 
Kalim Julia said:
Anybody knows how to set NumericUpDown's font in runtime.
I've tried ....

mlNUMERICUPDOWN.Font.Size = 10
But the system said that Property 'size' is 'ReadOnly'

\\\
Me.NumericUpDown1.Font = _
New Font(Me.NumericUpDown1.Font.FontFamily, 12.0F)
///
 
\\\
Me.NumericUpDown1.Font = _
New Font(Me.NumericUpDown1.Font.FontFamily, 12.0F)
///

Out of curiosity: Would it not be more correct to write

nud.Font = New Font(nud.Font.Name, 14)

instead of FontFamily? If I go to the docs for FontFamily, I read
"A FontFamily represents a group of fonts that have a similar font
face, but may have different sizes and styles (for example, Arial,
Times New Roman, and Verdana)."

Is it possible that the current font (name) might be a member of a
font family, but not the default font (name), meaning that specifying
FontFamily could result in a different, albeit related font?

I suppose specifying the font family will work most of the time
when sticking to the standard fonts. Just wondering if it wouldn't
be safer to specify the font name instead - at least in this case
where the font name is already known to exist.

?

Regards,

/JB
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top