Results 1 to 10 of 10

Thread: [RESOLVED] Form and its controls are not sizing correctly w/Win10 and Dell XPS 13 QHD display

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2013
    Location
    San Francisco, CA
    Posts
    487

    Resolved [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):

    Name:  Desktop image.jpg
Views: 482
Size:  30.2 KB

    And here is the same form on my new laptop (3200x1800):

    Name:  Laptop image.jpg
Views: 446
Size:  28.5 KB

    What can I do to make my applications display properly on my laptop? Any advice will be much appreciated.
    Last edited by Mark@SF; Dec 13th, 2015 at 05:36 PM.

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,302

    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.

  3. #3
    You don't want to know.
    Join Date
    Aug 2010
    Posts
    4,578

    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.
    This answer is wrong. You should be using TableAdapter and Dictionaries instead.

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2013
    Location
    San Francisco, CA
    Posts
    487

    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?
    Last edited by Mark@SF; Dec 13th, 2015 at 11:11 PM.

  5. #5
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,302

    Re: Form and its controls are not sizing correctly w/Win10 and Dell XPS 13 QHD displa

    Quote Originally Posted by Mark@SF View Post
    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.

  6. #6

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2013
    Location
    San Francisco, CA
    Posts
    487

    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 View Post
    ...though there's something else in App.Config that may help.
    Can you elaborate a bit more on this point?

  7. #7
    You don't want to know.
    Join Date
    Aug 2010
    Posts
    4,578

    Re: Form and its controls are not sizing correctly w/Win10 and Dell XPS 13 QHD displa

    Quote Originally Posted by Mark@SF View Post
    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.

    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.
    Last edited by Sitten Spynne; Dec 14th, 2015 at 09:05 AM.
    This answer is wrong. You should be using TableAdapter and Dictionaries instead.

  8. #8

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2013
    Location
    San Francisco, CA
    Posts
    487

    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.

  9. #9
    Super Moderator dday9's Avatar
    Join Date
    Mar 2011
    Location
    South Louisiana
    Posts
    11,715

    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?
    "Code is like humor. When you have to explain it, it is bad." - Cory House
    VbLessons | Code Tags | Sword of Fury - Jameram

  10. #10

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2013
    Location
    San Francisco, CA
    Posts
    487

    Re: Form and its controls are not sizing correctly w/Win10 and Dell XPS 13 QHD displa

    Quote Originally Posted by dday9 View Post
    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.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width