Mi spiego bene, io ho creato un ocx con dei controlli personalizzati di cui uno che è un TextBox con una label sulla sinistra. L'unico problema riscontrato è che se dal progetto inserisco questo controllo e modifico la proprietà font me la cambia al momento ma non me la salva ritornando all'impostazione di default. Vi posto le istruzioni da me inserite nell'oggetto dell'ocx:
Public Property Get Font() As StdFont
Set Font = txtData.Font
End Property
Public Property Set Font(ByVal New_Font As StdFont)
Set txtData.Font = New_Font
PropertyChanged "Font"
Call UserControl_Resize
End Property
Public Property Get BackColor() As OLE_COLOR
BackColor = txtData.BackColor
End Property
Public Property Let BackColor(ByVal New_BackColor As OLE_COLOR)
txtData.BackColor() = New_BackColor
shPro.BackColor() = New_BackColor
PropertyChanged "BackColor"
End Property
Public Property Get ForeColor() As OLE_COLOR
ForeColor = txtData.ForeColor
End Property
Public Property Let ForeColor(ByVal New_ForeColor As OLE_COLOR)
txtData.ForeColor() = New_ForeColor
PropertyChanged "ForeColor"
End Property
Private Sub UserControl_ReadProperties(PropBag As PropertyBag)
...
txtData.BackColor = PropBag.ReadProperty("BackColor", &H80000005)
txtData.ForeColor = PropBag.ReadProperty("ForeColor", &H80000012)
Set Font = PropBag.ReadProperty("Font", txtData.Font)
...
End Sub
Private Sub UserControl_WriteProperties(PropBag As PropertyBag)
...
PropBag.WriteProperty "BackColor", BackColor, &H80000005
PropBag.WriteProperty "ForeColor", ForeColor, &H80000012
PropBag.WriteProperty "Font", Font, txtData.Font
...
End Sub
------------------------------------------------------------------
txtData è l'oggetto textBox nel controllo da me creato. Ho inserito anche le istruzioni delle proprietà backcolor e forecolor che funzionano perfettamente.
Se qualcuno sa darmi spiegazioni perché la proprietà font non funziona gliene sarei grato.
Sono disponibile ad ulteriori spiegazioni, grazie