Designers and Abstract Classes

  • Thread starter Thread starter Joey Callisay
  • Start date Start date
J

Joey Callisay

Brian Pepin has an interesting article at
http://www.urbanpotato.net/Default.aspx/document/970.

The Visual Studio designer works by actually creating instances of objects
on your form. If you have a form with two buttons and a text box, for
example, the form designer creates two real buttons and a real text box. The
one thing the designer cannot create, however, is an instance of your form.
Why? Because you're currently designing it, and it isn't compiled. Instead,
the form designer creates an instance of your form's base class. If you're
just inheriting from Form, that's what gets created. If you're inheriting
from "MyBaseForm", it creates an instance of that. Once the base form
instance is created, the form designer interprets all the code within the
InitializeComponent method to create the other controls on the form.

The line "interprets all the code within the InitializeComponent method"
boggles me. How does VS know the settings in the InitializeComponent if it
never executes these lines at design time. Does anyone here know how this
interpretation is done?
 
* "Joey Callisay said:
The line "interprets all the code within the InitializeComponent method"
boggles me. How does VS know the settings in the InitializeComponent if it
never executes these lines at design time. Does anyone here know how this
interpretation is done?

VS creates the code using CodeDom, so it's also able to "interpret" this
code.
 
Back
Top