Capture Designer Code

  • Thread starter Thread starter localhost
  • Start date Start date
L

localhost

How can I capture all of the layout code from the designer into the
"code behind" of a WinForm?

For example, if I drag a textbox on a form and then modify the
CharacterCasing property in the designer, it appears in the code. But
virtually no other properties show unless I change them as well.

How can I get every PEM for every control to show in my "code behind"?

Thanks.
 
Hi,


This is a by-design behavior, the code-serialization mechiansim will check
the result of the call to PropertyDescriptor.ShouldSerializeValue on a
certain property.
If it return false, then this property will not be serialized into code.



When the Form is loading, these properties is left with their initial value
unchanged. Why you need serilialized all of them into code? And I'm not
clear about the meaing of the abbreviation "PEM". Could you make it clear
for me?
If you only want to serialize all your properties for your own component,
you may implement the ICustomTypeDescriptor interface to return your own
PropertyDescriptor. Always return true in your ShouldSerilializeValue
method.

You can find a good sample about ICustomTypeDescriptor in .NET Framework
SDK sample directory:
\SDK\v1.1\Samples\Tutorials\resourcesandlocalization\reseditor


If you have anything unclear on this issue, please feel free to reply this
thread.
Thanks!



Best regards,

Ying-Shen Yu [MSFT]
Microsoft community Support
Get Secure! - www.microsoft.com/security

This posting is provided "AS IS" with no warranties and confers no rights.
This mail should not be replied directly, please remove the word "online"
before sending mail.
 
Back
Top