PropertyGrid info

  • Thread starter Thread starter Emmet Cummings
  • Start date Start date
E

Emmet Cummings

Hi,

I have a usercontrol that resizes itself based on the font size. When you
enter the font in the property grid the control resizes itself correctly in
design mode, but when the application is run, it uses the default font. So
my question is how do I get at the font entered in the property grid for
when I run the app. Where is that info stored?

Thanks,
Em
 
Emmet said:
I have a usercontrol that resizes itself based on the font size. When you
enter the font in the property grid the control resizes itself correctly
in design mode, but when the application is run, it uses the default
font. So my question is how do I get at the font entered in the property
grid for when I run the app. Where is that info stored?

It sounds as though the Font change isn't being serialized, which is odd.
You'll need to implement two methods:

(code assumes that the property is named Font)

Private Sub ResetFont()
'Set the Font to the default value here
End Sub

Private Function ShouldSerializeFont() As Boolean
'Check the current value of the font versus the default. If they're
different, return True, else False.
End Function
 
Jacob Grass said:
It sounds as though the Font change isn't being serialized, which is odd.
You'll need to implement two methods:
(code assumes that the property is named Font)

Private Sub ResetFont()
'Set the Font to the default value here
End Sub

Private Function ShouldSerializeFont() As Boolean
'Check the current value of the font versus the default. If they're
different, return True, else False.
End Function


Thanks for the code, Jacob. The problem was that I was overriding the Font
property instead of listening for
FontChanged. The code helps for other properties though.

Thanks,
Em
 
Back
Top