Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / VB.NET / October 2004

Tip: Looking for answers? Try searching our database.

textbox -usercontrol problem

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Agnes - 26 Oct 2004 03:57 GMT
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 `~

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.