-2

I'm making a application that I need to change the layout of all the controls on the form. Is there a way I can do this other than having a couple dozen lines of code relentlessly doing something such as:

    Picturebox1.Left = 10
    Picturebox1.Top = 40
    Picturebox1.BackgroundImage = My.Resources.Image1

And so on. My first though was maybe I could create multiple .designer.vb files and execute them when I need to change the form. If I could just make a separate project to design the layout, then copy it's .designer.vb file and execute them as I need them, that would work. If I can't do so, what would the easiest and shortest way to do that be?

Polaric
  • 61
  • 1
  • 1
  • 8
  • 1
    Your question is unclear; are you talking about ASP.NET? WinForms? WPF? Why do you "change the layout of all the controls" and how are you doing that? Please [explain what you are trying to accomplish](http://meta.stackexchange.com/questions/66377), not what technique you have decided to use. Are you trying to make the controls fit in a window as it is resized? Investigate docking. Or are you trying to pack controls into a fixed area? Investigate FlowLayouts. – Dour High Arch May 30 '13 at 00:54
  • Do you need to produce separate executables with the same controls with different layouts, or separate instances of the form within the same application, with different layouts? – Mark Hurd May 30 '13 at 02:30

1 Answers1

0

You could just have separate forms. The default modifier(Friend) on the controls means you can access them from any where in the project. If you're basically using the same controls but in a different layout, you could even share the same event handlers with the controls on different forms.

tinstaafl
  • 6,908
  • 2
  • 15
  • 22