I've written a program that I've used and have tested it on xp, win7 and win 10 with various resolutions.
The main form displays correctly with the controls properly spaced as follows:
Correctly Scaled Form
However, when submitting it for review, the forms do not scale for the tester's system. The controls are overlapping and get cut off by the form edges and looks like this:
Incorrectly Scaled Form
The form is designed to resize and adjust the controls which all works perfectly on any system I test, I have tried changing the "autoscalemode" to "font" or "off" but nothing changes how it loads on the testers system.
I have submitted other programs that have not had this issue so I am at a loss as to what it could be.
Related
I have an application which uses three UI frameworks:
OWL
Windows Forms
WPF
The WinForms and WPF forms and dialogs use fonts that are noticeably smaller than the OWL fonts.
If I use DPI scaling (to 125%) in Windows 10, it does a very good job of upscaling a Windows Forms dialog. If I use Scale on a Windows Form it only scales the controls and not the fonts. If I use the functions suggested here:
https://github.com/Microsoft/WPF-Samples/blob/master/PerMonitorDPI/WinFormsHost/MainWindow.xaml.cs
I get scaled controls but not fonts if I only use the form scaling. If I use the extra font scaling functions, that increases the size of the dialog way beyond the original desired scaling (from 1.25 to 1.6 roughly).
Does anyone know how to scale a WinForms form properly like Windows 10 seems to be able to (without changing screen DPI setting to 125%)?
The answer is to place everything in a flow layout or a table layout. Then spend time figuring out how to make sure they layout correctly.
A better answer would be WPF but that's not always an answer.
I am having an issue with auto scaling while trying to create a Windows forms app. I'm currently running on a Dell laptop with a 3840 x 2160 display (4K). I'm trying to add an image to a picture box, and if I leave the picture at its native size (which is quite small on my display) it appears at a correct autosized scale when I go to run the app. The issue with this is at the native picture's size it is very difficult to lay out all the other items I want to add to the app. If I increase the size of the picture to something that is usable it increase the size of the image to something large enough it doesn't fit on my screen. I know this is likely due to the auto scaling Windows 10 does, but I wanted to see if anyone else might have a work around for this? I've tried to see if there is a way to zoom in the display in the designer window, but I haven't found anything. I have also noticed the size of the windows forms app itself changes depending on where I have items placed on it.
I don't know that I completely understand what you're asking, but I would assume it could have something to do with the pixel units of your elements. Here's an excellent explanation of point-based vs pixel-based sizing
I recently introduced a WPF control to my VB.net WinForms application. The control looks good and works great. However, depending on which environment I run the application, I will get different behavior. The two machines that differ are both running Windows 8.1 with the default theme.
I have read a few questions about adding proper theme settings and I don't believe that is the issue.
In the environment that is incorrect I have observed the following behavior:
Upon loading the form containing the WPF control, the calling form will resize and move around the screen
Controls contained within the form that also contains the WPF control will often "ghost" upon resizing the application
Both the calling form and the form containing the WPF control shrank upon loading the containing form. By shrank I mean window size, control size of all controls, font size, etc...
I'm wondering if the application was built against one version of the library and the DLL versions differ on the deployment environments. But I'm not sure how to look for this.
Has anyone encountered this before?
I found the problem.
This was the result of DPI scaling. The application was acting out anytime the DPI settings were set to anything other than 100%. WPF controls scale differently from Winform controls causing the strange behavior. The following stackoverflow Q/A explains how to remove the DPI dependency
Disable DPI awareness for WPF application
We are building a Windows application in .NET and one of its requirements is touch screen monitor. Other than that, it's a normal windows form based application. But except for making UI items little bigger for touch, I can't find anything I as a developer need to do for the requirement since touch screen is basically mouse operations. Am I missing something?
No, you are not missing anything. Do get the actual hardware hooked up so you can test it, "little bigger" is invariably underestimating the problem of fat fingers. Everything should work from a single click, right-clicks are horribly impractical, double-clicks are best avoided.
The only other thing you'll want to do is go into the Control Panel + Display applet and change the size of standard Windows UI elements. Pick a large window caption font if you want to allow the user to drag or close windows. Make the scrollbars at least twice as wide. And the menu and message box font. Go in the Mouse applet to increase double-click range and time if you want to support that.
If you do not need touch-specific event handling I think it's all you have to do. But touch means more than that and you may want to support it in a better way: http://archive.msdn.microsoft.com/WindowsTouch/Release/ProjectReleases.aspx?ReleaseId=2127
In my C# .NET 3.5 application I am using WinForms forms with docking and anchoring. I am working on a desktop with big display and on a small laptop.
A few forms has a list view with anchors set to both 4 bounds and a few buttons below.
My forms are shown incorrectly: if I edit a form on the desktop computer, on the notebook the lowest buttons will be not shown (will be cut by a container bounds) and I only see stretched list view. If I edit a form on the laptop, on the desktop computer it will not fill the container completely.
I found the reason - the form's AutoScaleDimensions differs for these two computers, on the desktop it is (8F, 16F) while on the laptop it is (6F, 13F). I am puzzled of how to make my GUI working on both?
It seems I found the solution myself: the reason of incorrect behavior was that my user control and containing forms were designed on different computers so they scaling did not match. After I opened them all in a single computer and set user control's AutoScaleMode = AutoScaleMode.Inherit, it worked perfectly.