Question

I'm consulting on a large .Net winforms project that has to be able to run in "Touch" mode so it can be operated using a touch screen interface. The application architecture already contains scaling logic for enlarging the fonts/display on the standard .Net forms and controls and the custom controls also handles the scaling.

The problem is that the application uses OpenFileDialog and SaveFileDialog which does not scale using the same logic (which is essentially adjusting the size of the Font property on the control and the forms recursively). I believe that these dialogs are essentially native Windows dialogs and the OpenFileDialog class are really just wrapper classes that expose a standard .Net interface to interact with them.

One solution could be to implement custom dialogs for these things, but that would probably be somewhat extensive work. What we really would like to do is to somehow scale the font size of this particular dialog (perhaps through some P/Invoke window-handle magic)?

I know that one solution for touch-enabling would be to adjust the font size of Windows in general, but that idea is not really catching on with this company, they would rather scale the app itself and leave the rest of the OS untouched.

So, any experience or ideas as to how you could scale these dialogs to a larger font? Or should we just bite the bullet and create custom dialogs for this?

Was it helpful?

Solution

I know that one solution for touch-enabling would be to adjust the font size of Windows in general, but that idea is not really catching on with this company, they would rather scale the app itself and leave the rest of the OS untouched.

The dialogs you refer to are part of "the rest of the OS" that they would rather leave untouched. You either use the common dialogs, being forced to increase the font scaling in control panel, i.e. system-wide, or re-implement those dialogs yourself.

An alternative might be to create a separate Windows desktop using the appropriate API, increase its font scaling, and execute the app there (i.e. let the app create, use, and destroy that desktop). Then, the app and all common dialogs would be scaled up. The app would never be seen with other apps on one screen, though, and you would have to take care of switching desktops in the app (I think). And you would not see anything but the app GUI when the app is active. No start button, no taskbar, no nuttin´. See for example http://www.codeproject.com/KB/cs/csdesktopswitching.aspx for details.

OTHER TIPS

The best solution for you would be to create a form implement the header with a label and with close botton and in the rest of the form put what u need. In that case labels font may be increased to whatever size u wish. when u what to shoe this dialog just call .sohwDialog() on the form

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top