views:

95

answers:

1

Is it possible to implement different layouting modes for a windows form without having to manual compute the alignment locations?

For example: I have a Form which should be able to displayed in two modes normal & touchscreen. Touch screen mode being the same form with larger buttons, larger fonts and should not have alignment issues.

Does .NET framework 2.0 provide support for something like this? if not what would be the best way to implement this ? I am looking for a reusable strategy which I might want to use across a lot of screens

+2  A: 

I have no idea of what it takes to make a touchscreen 'mode' of a control in Winforms, but I suppose that it basically consists in scaling control sizes and text.

If that is true, then the layout part could be easily accomplished using the default Winforms layout strategies and layout controls, like the System.Windows.Forsm.TableLayoutPanel.

Just configure the number of rows and columns of the table layout panel, set width and height maximum and minimum size restrictions on the dimensions that make sense to your form, Dock and Anchor styles for the controls that need it, and set new sizes for the 'touchscreen mode' of your controls. The Winforms layout infrastructure will make the layout scale nicely according to the specified restrictions.

I highly recommend reading the Windows Forms Layout FAQ (it is more like a tutorial/guide) for more information of what can be accomplished:

(link to a Microsoft Word document)

http://www.windowsforms.com/Samples/Go%20To%20Market/Layout/layoutGTM.doc

Sergio Acosta