Font property not fully working
Hi
I have added a Font property to my active x control so developers can change the font using vb's properties window
To do this I have the following code..
VB Code:
Public Property Set Font(ByVal oFont As StdFont)
Debug.Print "1.Write Font Size: " & m_oFont.Size
With m_oFont
.Bold = oFont.Bold
.Charset = oFont.Charset
.Italic = oFont.Italic
.Name = oFont.Name
.Size = oFont.Size
.Strikethrough = oFont.Strikethrough
.Underline = oFont.Underline
.Weight = oFont.Weight
End With
PropertyChanged "Font"
Debug.Print "2.Write Font Size: " & m_oFont.Size
End Property
Public Property Get Font() As StdFont
Set Font = m_oFont
End Property
And here is my Property bag methods
VB Code:
Private Sub UserControl_WriteProperties(PropBag As PropertyBag)
PropBag.WriteProperty "Font", m_oFont
End Sub
Private Sub UserControl_ReadProperties(PropBag As PropertyBag)
Debug.Print "1.Read Font Size: " & m_oFont.Size
m_oFont = PropBag.ReadProperty("Font")
Debug.Print "2.Read Font Size: " & m_oFont.Size
End Sub
now If i pop my control on my form and set a new font with the font dialog then click ok to confirm that font, the font is set to what i need.
But when i click run, all the font property values are reset except Font.Name
I dont understand why only the Font Name works, all the other attributes like bold, size, type etc reset to there default values.
Does anyone know why this is doing this to me?
Thanks