Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Follow-up info on prior question [subclassing controls]
Message
From
04/05/2003 15:13:04
 
 
To
All
General information
Forum:
ASP.NET
Category:
Forms
Title:
Follow-up info on prior question [subclassing controls]
Miscellaneous
Thread ID:
00784708
Message ID:
00784708
Views:
59
I can probably re-state my question a little more clearly. Here are the steps I'm following:

1) I create a label class with a font of Arial 8 bold. Basically, I'm doing the following:

public SgiLabel()
{
// This call is required by the Windows.Forms Form Designer.
InitializeComponent();
this.Font = new Font("Arial",18,System.Drawing.FontStyle.Bold );
}


2) I drop the label class on a form, and set the text to "test"
3) If I look in the form code [in the Windows Form Designer generated code], I see a reference to the following:

this.sgiLabel1.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Bold);

4) Now I'll go back to the label class and change the Arial 8 bold [maybe to Arial 10 bold],

5) When I load the form again that had the label class on it, the font still reads Arial 8 bold...not the Arial 10 bold that I changed it to in step 4.

6) The only way I can set it to what it 'should' be is to bring up the font property in the property sheet, right-click, and then select RESET.

Maybe I'm missing something here. I could do this easily in VFP...so long as I never explictly tried to override the front on the form where the label was dropped, it would always inherit from my class. However, it seems that the inheritance gets 'broken' right away...but again, I might be doing something wrong.

Any clues? I'm trying to subclass all the standard WinForm controls, and this isn't working the way I had expected. Help!

Thanks,
Kevin
Next
Reply
Map
View

Click here to load this message in the networking platform