Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 148157
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T08:54:30+00:00 2026-05-11T08:54:30+00:00

Follow up to this question: Winforms Style / UI Look and Feel Tips So

  • 0

Follow up to this question:

Winforms Style / UI Look and Feel Tips

So I have created my ‘base controls’ from which other controls inherit from. For testing, I am trying to change one of the base label’s font. But it is not propagating to the controls that inherit from it. On one of the forms, I can see the designer file is setting the properties for the control, so my base control’s properties are getting overridden.

On the base control’s I am using the Constructor to set the default properties. Should I be using a different event? If so, which one.

Here is the code for one of the base controls based on comment request…

Public Class InfoLabel     Inherits Label      Public Sub New()         ' This call is required by the Windows Form Designer.         InitializeComponent()          ' Add any initialization after the InitializeComponent() call.         Me.Font = New System.Drawing.Font('Tahoma', 14.25!)         Me.ForeColor = System.Drawing.Color.FromArgb(CType(CType(49, Byte), Integer), CType(CType(97, Byte), Integer), CType(CType(156, Byte), Integer))         Me.AutoSize = False      End Sub End Class 

The base controls show on the projects toolbox on the winform editor. Controls are then drag/drop from the toolbox.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T08:54:30+00:00Added an answer on May 11, 2026 at 8:54 am

    Your problem is your custom control’s InitializeComponent() method. I have no idea why that is there. You would get that method automatically if you were implementing a UserControl, but inheriting from a standard control that method should not be there. With your base class having an InitializeComponent() method and your subclass also having one, someone is overwriting someone else.

    I just subclassed a label in C#. I dragged this on my form and the font displayed as the new font, not the base (Label) class’s font.

    using System.Drawing; using System.Windows.Forms;  namespace WindowsFormsApplication1 {     public class MyLabel : Label     {         public MyLabel()         {             Font = new Font('Candara', 14);         }     } } 

    I then created a second label, called MySubLabel which inherited from the MyLabel class. When I changed the ForeColor on the MyLabel class, the MySubLabel automatically updated.

    So this should work.

    Caveat: in Visual Studio you need to recompile the assembly before trying to see updates in the designer.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is a follow-on from this question, in which I was trying to suppress
Follow up to this question . I have the following code: string[] names =
This question is a follow on from this one ... I am binding to
As a follow up to this question , I have a parent entity that
From my previous question for selecting specific html text, I have gone through this
Follow up to this question This (similar version from old link) works in SQL
This question is a follow-up of this Question I have written a small method
This is a follow up from this question, Lock Cells after Data Entry .
Follow-up to this question: Setting background-color of select options in JQuery I have a
This is follow on from this question: Format List<T> to concatenate fields . The

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.