Public Property Let BackStyle(ByVal New_Style As fmBackStyle) TBox.BackStyle = New_Style: PropertyChanged "BackStyle" End Property Public Property Get BackStyle() As fmBackStyle BackStyle = TBox.BackStyle End Property Private Sub UserControl_ReadProperties(PropBag As PropertyBag) BackStyle = PropBag.ReadProperty("BackStyle", fmBackStyleOpaque) end sub Private Sub UserControl_WriteProperties(PropBag As PropertyBag) Call PropBag.WriteProperty("BackStyle", BackStyle, fmBackStyleOpaque) end sub
Public Enum BackStyleConstants Transparent = 0 Opaque = 1 End Enum Public Property Let BackStyle(ByVal New_Style As BackStyleConstants) UserControl.BackStyle = New_Style PropertyChanged "BackStyle" End Property Public Property Get BackStyle() As BackStyleConstants BackStyle = UserControl.BackStyle End Property Private Sub UserControl_ReadProperties(PropBag As PropertyBag) UserControl.BackStyle = PropBag.ReadProperty("BackStyle", BackStyleConstants.Opaque) End Sub Private Sub UserControl_WriteProperties(PropBag As PropertyBag) Call PropBag.WriteProperty("BackStyle", UserControl.BackStyle, BackStyleConstants.Opaque) End Sub
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionPrivate Sub UserControl_ReadProperties(PropBag As PropertyBag) 'BackStyle = PropBag.ReadProperty("BackStyle", fmBackStyleOpaque) TBox.BackStyle = PropBag.ReadProperty("BackStyle", fmBackStyleOpaque) end sub Private Sub UserControl_WriteProperties(PropBag As PropertyBag) 'Call PropBag.WriteProperty("BackStyle", BackStyle, fmBackStyleOpaque) Call PropBag.WriteProperty("BackStyle", TBox.BackStyle, fmBackStyleOpaque) end sub
'Valeurs de propriétés par défaut: Const m_def_BackColor = 0 Const m_def_ForeColor = 0 Const m_def_Enabled = 0 Const m_def_BackStyle = 0 Const m_def_BorderStyle = 0 'Variables de propriétés: Dim m_BackColor As Long Dim m_ForeColor As Long Dim m_Enabled As Boolean Dim m_BackStyle As Integer Dim m_BorderStyle As Integer 'Déclarations d'événements: Event Click() Event DblClick() Event KeyDown(KeyCode As Integer, Shift As Integer) Event KeyPress(KeyAscii As Integer) Event KeyUp(KeyCode As Integer, Shift As Integer) Event MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) Event MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) Event MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single) 'ATTENTION! NE SUPPRIMEZ PAS OU NE MODIFIEZ PAS LES LIGNES COMMENTÉES SUIVANTES! 'MemberInfo=8,0,0,0 Public Property Get BackColor() As Long BackColor = m_BackColor End Property Public Property Let BackColor(ByVal New_BackColor As Long) m_BackColor = New_BackColor PropertyChanged "BackColor" End Property 'ATTENTION! NE SUPPRIMEZ PAS OU NE MODIFIEZ PAS LES LIGNES COMMENTÉES SUIVANTES! 'MemberInfo=8,0,0,0 Public Property Get ForeColor() As Long ForeColor = m_ForeColor End Property Public Property Let ForeColor(ByVal New_ForeColor As Long) m_ForeColor = New_ForeColor PropertyChanged "ForeColor" End Property 'ATTENTION! NE SUPPRIMEZ PAS OU NE MODIFIEZ PAS LES LIGNES COMMENTÉES SUIVANTES! 'MemberInfo=0,0,0,0 Public Property Get Enabled() As Boolean Enabled = m_Enabled End Property Public Property Let Enabled(ByVal New_Enabled As Boolean) m_Enabled = New_Enabled PropertyChanged "Enabled" End Property 'ATTENTION! NE SUPPRIMEZ PAS OU NE MODIFIEZ PAS LES LIGNES COMMENTÉES SUIVANTES! 'MappingInfo=TextBox1,TextBox1,-1,Font Public Property Get Font() As Font Set Font = TextBox1.Font End Property Public Property Set Font(ByVal New_Font As Font) Set TextBox1.Font = New_Font Set UserControl.Font = New_Font PropertyChanged "Font" End Property 'ATTENTION! NE SUPPRIMEZ PAS OU NE MODIFIEZ PAS LES LIGNES COMMENTÉES SUIVANTES! 'MemberInfo=7,0,0,0 Public Property Get BackStyle() As Integer BackStyle = m_BackStyle End Property Public Property Let BackStyle(ByVal New_BackStyle As Integer) m_BackStyle = New_BackStyle PropertyChanged "BackStyle" End Property 'ATTENTION! NE SUPPRIMEZ PAS OU NE MODIFIEZ PAS LES LIGNES COMMENTÉES SUIVANTES! 'MemberInfo=7,0,0,0 Public Property Get BorderStyle() As Integer BorderStyle = m_BorderStyle End Property Public Property Let BorderStyle(ByVal New_BorderStyle As Integer) m_BorderStyle = New_BorderStyle PropertyChanged "BorderStyle" End Property 'ATTENTION! NE SUPPRIMEZ PAS OU NE MODIFIEZ PAS LES LIGNES COMMENTÉES SUIVANTES! 'MemberInfo=5 Public Sub Refresh() End Sub 'ATTENTION! NE SUPPRIMEZ PAS OU NE MODIFIEZ PAS LES LIGNES COMMENTÉES SUIVANTES! 'MappingInfo=TextBox1,TextBox1,-1,AutoSize Public Property Get AutoSize() As Boolean AutoSize = TextBox1.AutoSize End Property Public Property Let AutoSize(ByVal New_AutoSize As Boolean) TextBox1.AutoSize() = New_AutoSize PropertyChanged "AutoSize" Call UserControl_Resize End Property 'ATTENTION! NE SUPPRIMEZ PAS OU NE MODIFIEZ PAS LES LIGNES COMMENTÉES SUIVANTES! 'MappingInfo=TextBox1,TextBox1,-1,Text Public Property Get Text() As String Text = TextBox1.Text End Property Public Property Let Text(ByVal New_Text As String) TextBox1.Text() = New_Text PropertyChanged "Text" End Property 'Initialiser les propriétés pour le contrôle utilisateur Private Sub UserControl_InitProperties() m_BackColor = m_def_BackColor m_ForeColor = m_def_ForeColor m_Enabled = m_def_Enabled m_BackStyle = m_def_BackStyle m_BorderStyle = m_def_BorderStyle End Sub 'Charger les valeurs des propriétés à partir du stockage Private Sub UserControl_ReadProperties(PropBag As PropertyBag) m_BackColor = PropBag.ReadProperty("BackColor", m_def_BackColor) m_ForeColor = PropBag.ReadProperty("ForeColor", m_def_ForeColor) m_Enabled = PropBag.ReadProperty("Enabled", m_def_Enabled) Set Font = PropBag.ReadProperty("Font", Ambient.Font) m_BackStyle = PropBag.ReadProperty("BackStyle", m_def_BackStyle) m_BorderStyle = PropBag.ReadProperty("BorderStyle", m_def_BorderStyle) TextBox1.AutoSize = PropBag.ReadProperty("AutoSize", Faux) TextBox1.Text = PropBag.ReadProperty("Text", "") End Sub Private Sub UserControl_Resize() TextBox1.Top = 0 TextBox1.Left = 0 TextBox1.Width = UserControl.Width TextBox1.Height = UserControl.Height End Sub 'Écrire les valeurs des propriétés dans le stockage Private Sub UserControl_WriteProperties(PropBag As PropertyBag) Call PropBag.WriteProperty("BackColor", m_BackColor, m_def_BackColor) Call PropBag.WriteProperty("ForeColor", m_ForeColor, m_def_ForeColor) Call PropBag.WriteProperty("Enabled", m_Enabled, m_def_Enabled) Call PropBag.WriteProperty("Font", TextBox1.Font, Ambient.Font) Call PropBag.WriteProperty("BackStyle", m_BackStyle, m_def_BackStyle) Call PropBag.WriteProperty("BorderStyle", m_BorderStyle, m_def_BorderStyle) Call PropBag.WriteProperty("AutoSize", TextBox1.AutoSize, Faux) Call PropBag.WriteProperty("Text", TextBox1.Text, "") End Sub
TextBox1.AutoSize = PropBag.ReadProperty("AutoSize", Faux)