Modify Visual Studio's form designer code generator
I'd like to basically control the name of the method that the Visual Studio form designer uses for putting it's generated code in. By default, this is named InitializeComponent
. But often times I need to have different layouts for different types of screen resolutions/aspect ratios (see Designing forms to work on different resolutions and aspect ratios on Windows CE for more detail). That way, at runtime I can choose how to layout the form by calling the appropriate one.
I realize that there is likely no trivial way to do this. I assume I'll need to build a custom VS add-in and extend the existing forms designer and hook into the code generator and layout interpreter for this to work properly. Any i开发者_JAVA技巧deas on where I could start looking to make this happen?
Can you not switch within InitializeComponent
and call different layout logic methods according to what platform you are?
if(platform.IsCE)
{
CELayout();
}
else if (platform.Tablet)
{
TabletLayout();
}
精彩评论