views:

79

answers:

1

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 ideas on where I could start looking to make this happen?

A: 

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();
}
Oded
I suppose I could do that, however, since all of the code in the InitializeComponent method is generated I would still need a way to add that logic.
Jason