2 Attachment(s)
[RESOLVED] Form and its controls are not sizing correctly w/Win10 and Dell XPS 13 QHD display
I bought a new laptop - Dell XPS 13 (touch) with a QHD+ display (3200x1800 resolution). My desktop machine has a ViewSonic VP201 monitor (1600x1200 resolution).
I have created several VB.Net applications using VS2010 on the desktop machine. I've copied these applications to my new laptop. When I run any of these applications on my laptop the windows forms and their controls are not properly sizing.
For example, here is what one form looks like on my desktop machine (1600x1200):
Attachment 133203
And here is the same form on my new laptop (3200x1800):
Attachment 133199
What can I do to make my applications display properly on my laptop? Any advice will be much appreciated.
Re: Form and its controls are not sizing correctly w/Win10 and Dell XPS 13 QHD displa
Try playing with the AutoScale and AutoScaleMode properties of the form.
Re: Form and its controls are not sizing correctly w/Win10 and Dell XPS 13 QHD displa
In particular, follow directions like this, though there's something else in App.Config that may help.
WinForms sometimes doesn't work well in high-DPI scenarios, but we can't blame it, it's based on 30-year-old tech and a world where 640x480 was only used by Hollywood professionals.
Re: Form and its controls are not sizing correctly w/Win10 and Dell XPS 13 QHD displa
Appreciate your comments...will definitely dig deeper into this. I'm not the only one struggling with this - see this link (and its comments) for a pretty good summary of the issue:
http://www.hanselman.com/blog/Living...BePainful.aspx
Seems some who have bought hi-res laptops are rethinking that decision :(.
Not planning to dump my new XPS 13 laptop.
Is upgrading to VS2015 a part of the solution?
Re: Form and its controls are not sizing correctly w/Win10 and Dell XPS 13 QHD displa
Quote:
Originally Posted by
Mark@SF
Is upgrading to VS2015 a part of the solution?
Windows Forms is still Windows Forms. There have been no changes to WinForms that I'm aware of for quite some time.
Re: Form and its controls are not sizing correctly w/Win10 and Dell XPS 13 QHD displa
Sitten Spynne -
Quote:
Originally Posted by
Sitten Spynne
...though there's something else in App.Config that may help.
Can you elaborate a bit more on this point?
Re: Form and its controls are not sizing correctly w/Win10 and Dell XPS 13 QHD displa
Quote:
Originally Posted by
Mark@SF
Appreciate your comments...will definitely dig deeper into this. I'm not the only one struggling with this - see this link (and its comments) for a pretty good summary of the issue:
http://www.hanselman.com/blog/Living...BePainful.aspx
Seems some who have bought hi-res laptops are rethinking that decision :(.
This is a chronic problem in the Windows ecosystem: MS developers like for something to be at least 20 years old before they start considering it. See: all the .NET code on this forum using Call and Mid$ like it's 1999. (Though in Call's case it's more like 1989.)
MS started telling developers to support high DPI back in 2006 or so, even earlier if you count the WPF betas, when it was 'Avalon'. 10 years later, finding a VB developer that can write Hello World in WPF is like finding a rude Canadian.
Quote:
Not planning to dump my new XPS 13 laptop.
Is upgrading to VS2015 a part of the solution?
Not really. You have to read the documentation and fiddle with your AutoScaling properties a lot. When I read the MSDN docs, they seemed apologetic, almost as if MS was admitting the solution wasn't perfect and only worked in certain scenarios. Another solution is to manually check the DPI yourself, though what I saw in another thread related to this is the scaling is happening beyond your code's control, and if you ask Windows for the DPI it happily pretends the answer is 96 when it's really more like 185+. What I mean to say is there's some mechanism outside of Windows Forms' control that's trying to help, and it makes things worse.
The easiest solution is to learn WPF and start writing apps that way. "Easy" is a tricky word there, but I believe in 10 years the world of UI design is going to look more like WPF than Windows Forms, so every day you put it off is a sadder tomorrow. (Already Android, Windows Phone, and even iOS are adopting the same kind of structures. Though iOS/Mac OS is kind of thumbing its nose because Objective-C and Interface Builder had some of these features in the late 80s.)
I'll see if I can find the stuff about the App.Config settings when I get into work. Finding threads on this forum's tough.
*edit*
Here it is, faster than I thought. TnTinMN wrote a very detailed explanation. It looks like the gist is you tell Windows Forms to pound sand and do the work it poorly does by yourself, correctly.
Re: Form and its controls are not sizing correctly w/Win10 and Dell XPS 13 QHD displa
See also my related post http://www.vbforums.com/showthread.p...2015-Community for additional information and details on this issue. I've resolved the problem that the application will not compile (Debug), but still am having trouble getting it to compile (Release). In addition, I'm looking for help with a couple of VS2015 messages.
Re: Form and its controls are not sizing correctly w/Win10 and Dell XPS 13 QHD displa
Have you tried using the TableLayoutPanel control to handle the placement of all your controls?
Re: Form and its controls are not sizing correctly w/Win10 and Dell XPS 13 QHD displa
Quote:
Originally Posted by
dday9
Have you tried using the TableLayoutPanel control to handle the placement of all your controls?
I think the problem was not the QHD+ display resolution, but instead it was having VS2010-to-VS2015 migration issues. For example, the PowerPacks.Vs project reference was for VS2010 and needed to be deleted and the VS2015 reference added. The above referenced link to my other VBForums post has more details.
Thanks for responding and offering helpful advice! Always appreciate the experts on this forum.