using System; using System.Collections; using System.ComponentModel; using System.Drawing; using System.Data; using System.Windows.Forms; namespace ALS.Subclass { public class Label : System.Windows.Forms.Label { private System.ComponentModel.Container components = null; public Label() { InitializeComponent(); } protected override void Dispose( bool disposing ) { if( disposing ) { if(components != null) { components.Dispose(); } } base.Dispose( disposing ); } #region Component Designer generated code /// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { // // Label // this.AutoSize = true; this.Size = new System.Drawing.Size(0, 16); } #endregion } }I think I will switch over to your method of subclassing winform controls this weekend.
>using System; >using System.Drawing; >using System.Drawing.Drawing2D; >using System.Windows.Forms; > >namespace cgsControls >{ > public class cgsLabel: System.Windows.Forms.Label > { > override public Font Font > { > get { return base.Font; } > set { ; } > } > > public cgsLabel() > { > base.Font = new Font("Verdana",8); > } > } > > public class cgsTextBox: System.Windows.Forms.TextBox > { > override public Font Font > { > get { return base.Font; } > set { ; } > } > > public cgsLabel() > { > base.Font = new Font("Verdana",8); > } > } > >} >>