I create my own usercontrol which is [Inherits
System.Windows.Forms.TextBox], my purpose is set all textbox's font into the
same. Now , I can do it by using the following code
Protected Overrides Sub InitLayout()
Me.Font = New System.Drawing.Font("SimSun", 8)
........
However, during design mode I want to set the font into larger size e.g font
size 9, I can run it sucessfully in the 1st time, if I amend the form during
design mode again, the font size changed back to '8' again,
Please help `~
Charlie - 26 Oct 2004 07:41 GMT
You could shadow the Font property of the base control in the inherited control
Private _Font As Font = New Font("Times", 10, FontStyle.Regular)
Public Shadows Property Font() As Font
Get
Return Me._Font
End Get
Set(ByVal Value As Font)
Me._Font = Value
MyBase.Font = Value
End Set
End Property
Also, override OnCreateControl in your inherited control.
Protected Overrides Sub OnCreateControl()
MyBase.Font = Me.Font
MyBase.OnCreateControl()
End Sub
cfarrier@charlesfarriersoftware.com
> I create my own usercontrol which is [Inherits
> System.Windows.Forms.TextBox], my purpose is set all textbox's font into the
[quoted text clipped - 6 lines]
> design mode again, the font size changed back to '8' again,
> Please help `~