I'm making an OCX with a picturebox as it's main control.
It should default to picBackGrnd.AutoSize = True
But it's not working.
I can F8 as it crosses the UserControl_ReadProperties, but it doesn't change.
Do I need to write a properties page too?
Can someone help me?
Here's all the code that has anything to do with the sizing.
Code:Option Explicit Public Property Get AutoSize() As Boolean AutoSize = picBackGrnd.AutoSize End Property Public Property Let AutoSize(ByVal New_AutoSize As Boolean) picBackGrnd.AutoSize = New_AutoSize UserControl_Resize PropertyChanged "AutoSize" End Property Private Sub UserControl_ReadProperties(PropBag As PropertyBag) picBackGrnd.AutoSize = CBool(PropBag.ReadProperty("AutoSize", True)) End Sub Private Sub UserControl_WriteProperties(PropBag As PropertyBag) Call PropBag.WriteProperty("AutoSize", picBackGrnd.AutoSize, True) End Sub Private Sub UserControl_Initialize() With UserControl .picBackGrnd.Move 0, 0, .ScaleWidth, .ScaleHeight End With End Sub Private Sub UserControl_Resize() If picBackGrnd.AutoSize And m_bHas_Valid_File Then 'Make the Usercontrol the same size as the picbox UserControl.Height = picBackGrnd.Height UserControl.Width = picBackGrnd.Width Else 'A pic is not loaded or they want to make it a diff size picBackGrnd.Height = UserControl.Height picBackGrnd.Width = UserControl.Width End If End Sub


Reply With Quote