On Sat, 12 Apr 2008 16:59:44 -0700, Richard Carpenter
<ru*******@hotmail.comwrote:
[...]
1) Should I not expect the Text property value to be inherited from the
libForm control class?
I think not. For the same reason that writing a new class that inherits
Form still has the Text property's initial value explicitly overridden by
the Designer, so too would a new class that inherits from your custom
Form-derived class. That is, the Designer treats that property specially,
and adds explicit code in the .Designer.cs file to initialize it according
to the Designer's default.
2) With most Windows control types (textbox, label, etc.) they can be
added to the toolbox. I assume that the conventional method for
implementing a custom form class is just through the inherits statement.
Is that correct?
I'm sorry, I don't really understand this question. I don't see the
connection between the two different sentences, nor does C# have an
"inherits" statement (do you simply mean the ":" used in the class
declaration?).
A custom control that shows up in the Toolbox is simply the custom class
itself. You don't get new class inheriting that custom control when you
use something from the Toolbox. You just get a new instance of that class
itself (added to whatever container you drag it to).
You can create a custom form class with the designer by using the "Add New
Form..." menu item, or similar commands. Regardless of the specific route
you take, you'll get a whole new class added to your project, already
declared to inherit the Form class (e.g. "class Form1 : Form").
The syntax for inheriting the Form class isn't just "the conventional
method". It's the only way to do it. If you want to create a custom form
class -- that is, a new class that inherits the existing Form class -- you
have to use that syntax and inherit the Form class (either directly or via
a class that itself inherits the Form class).
Pete