Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Subclassing a control
Message
 
À
14/07/2008 15:50:03
Timothy Bryan
Sharpline Consultants
Conroe, Texas, États-Unis
Information générale
Forum:
ASP.NET
Catégorie:
The Mere Mortals .NET Framework
Versions des environnements
Environment:
C# 2.0
OS:
Windows Server 2003
Network:
Windows 2003 Server
Database:
MS SQL Server
Divers
Thread ID:
01329290
Message ID:
01331397
Vues:
17
Tim,
Thanks. Sometimes you just have to learn how to outsmart these things. I thought it was something I was missing about how to subclass the controls.

>Linda,
>
>>>>I am trying to create a class based on the mmTextBox class. I created a new class of UserControl, added the OakLeaf.MM.Main.Windows.Forms namespace and changed the parent class to mmTextBox. I then tried to change several properties, such as BackColor, Font, etc. I get an error when I compile indicating that the properties are readonly. How do I need to go about this? The code I tried is below. Thanks.
>>>>
>>>>
>>>>    public partial class EditStatusTextBox : mmTextBox
>>>>    {
>>>>        public EditStatusTextBox()
>>>>        {
>>>>            InitializeComponent();
>>>>            this.Text = "View";
>>>>            this.BackColor.R = 255;
>>>>            this.BackColor.G = 255;
>>>>            this.BackColor.B = 128;
>>>>        }
>>>>    }
>>>>
>>>
>>>Try to set them through extra properties.
>>
>>Naomi,
>>I don't know what you mean by that. I can't imagine how I would set up a new property for a font style or BackColor, since there are already properties with those names.
>
>You cannot set these properties this way apparently. You can however set the BackColor property other ways like this:
>this.BackColor = Color.Red; a named color. Or:
>this.BackColor = Color.FromArgb(255,255,128);
>
>Tim
>
>Update: The help file for VS confirms the .R, .G, .B properties are read only.
Linda Harmes
HiBit Technologies, Inc.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform