![]() | |
![]() |
| | Thread Tools | Search this Thread | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
How does the designer determine what code is used in the form designer code? For example 1, when you drag a control (using the object name?): private System.Windows.Forms.TextBox txtUserName; this.txtUserName = new System.Windows.Forms.TextBox(); |
#3
| |||
| |||
|
|
How does the designer determine what code is used in the form designer code? For example 1, when you drag a control (using the object name?): private System.Windows.Forms.TextBox txtUserName; this.txtUserName = new System.Windows.Forms.TextBox(); When you drag a component onto the designer surface, VS is knowing the class, then using reflection, it can get the list of public properties and events. As all components must implement IComponent (providing functionnality required by all components) and must inherit from Control, it is easy to generate the "new" code and to manage other common component behaviors. Nothing really magic, just object programming :-) -- OD___ www.e-naxos.com |
#4
| |||
| |||
|
|
Yes, I guess I should have said "What .NET objects are used to generate the code?" I want to alter the behavior. |
#5
| |||
| |||
|
|
Yes, I guess I should have said "What .NET objects are used to generate the code?" I want to alter the behavior. The way code is generated mostly depends on the component itself. For example, attributes such as Description, Browsable, default values, default event, etc, are used in component source code and help VS to display properties, to generate default event when you double-click the component under design, etc.. Changing this attributes will change the component behavior under design. But can you be more precise about what you're wanting to do, give a little sample if possible. I'm not sure to fully understand your goal. -- OD___ www.e-naxos.com |
#6
| |||
| |||
|
|
I'm looking for what classes are used in creating the code. |
#7
| |||
| |||
|
|
You might want to look at CodeDomSerializer and the DesignerSerializerAttribute. "schneider" <eschneider (AT) ooooooooo (DOT) com> wrote in message news:u4jLI2ByHHA.3564 (AT) TK2MSFTNGP06 (DOT) phx.gbl... Yes, I guess I should have said "What .NET objects are used to generate the code?" I want to alter the behavior. Thanks, Schneider "OD" <webmaster @ e-naxos dot com> wrote in message news:mn.7b647d77437ca577.18651 (AT) e-naxosdotcom (DOT) .. How does the designer determine what code is used in the form designer code? For example 1, when you drag a control (using the object name?): private System.Windows.Forms.TextBox txtUserName; this.txtUserName = new System.Windows.Forms.TextBox(); When you drag a component onto the designer surface, VS is knowing the class, then using reflection, it can get the list of public properties and events. As all components must implement IComponent (providing functionnality required by all components) and must inherit from Control, it is easy to generate the "new" code and to manage other common component behaviors. Nothing really magic, just object programming :-) -- OD___ www.e-naxos.com |
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
| |