Simos Sigma
Simos Sigma

Reputation: 978

Font property issue in usercontrol

I am working on a visual basic project builded using Visual Studio 2015. I have make a custom usercontrol that contains a RectangleShape and a textbox. Into usercontrol code I have added font properties...

Public Overrides Property Font() As Font
    Get
        Return TextBox.Font
    End Get
    Set(ByVal value As Font)
        TextBox.Font = value
    End Set
End Property

So I load my custom usercontrol to my project and for example, I change font's size.

enter image description here

My problem is that I can see the changes into design mode but not into run mode where shows the default font size!!!

enter image description here

Any idea?

Upvotes: 1

Views: 1392

Answers (1)

Simos Sigma
Simos Sigma

Reputation: 978

HansPassant gave the answer to this question!!! So, To help other people who may have the same question, this is how my custom font property should look...

Public Overrides Property Font() As Font
    Get
        Return MyBase.Font
    End Get
    Set(ByVal value As Font)
        MyBase.Font = value
        TextBox.Font = value
    End Set
End Property

Upvotes: 1

Related Questions