Tuesday, June 30, 2015

Visual Studio 2013 - Windows 8.1 - Preview for Forms messed up

I recently went looking for a solution to a problem that I'm having with my Surface Pro 3.  Not so much as a problem as an annoyance.  I use my Surface as a portable business machine because of how light and powerful it is, but it comes out of the box (as of early 2015) with Windows 8.1 Pro.  As a result of the Font Scaling that it does by default, when I use Visual Studio 2013 to design windows forms or other visual elements, all of the elements are scaled WAY differently in the design view or preview versus when the programs actually run.

Others have noticed the same thing:
https://social.msdn.microsoft.com/Forums/windowsdesktop/en-US/d8e321cf-ab3a-48fe-844c-9cf32ab0d7ca/visual-studio-2013windows-81-messed-up-forms?forum=windowscompatibility

One solution to the problem is to set the "size of all items" under Control Panel > Display > "Make text and other items larger or smaller" to 100% (or no scaling at all).  This has the unfortunate side effect of shrinking text EVERYWHERE (so Outlook items can be a bit hard to read because they are so small) but now at least the Visual Studio forms will look correct in design mode and when running.  Unfortunately when you change this setting you have to log out, so it's not something you can quickly switch on the fly.  Thankfully the Surface is pretty quick with Windows 8.1 and a factory-installed solid state hard-drive, so it's not a terrible burden to log off/on or restart, but it's not like you can just push a button and have the scaling change.

Another is to adjust the properties of the shortcut to Visual Studio to make it aware that it doesn't display correctly with high DPI settings:
http://superuser.com/questions/509766/cannot-disable-dpi-scaling-for-visual-studio-2012

These are some registry edits that appear to do the same thing as well:
http://blogs.technet.com/b/mspfe/archive/2013/11/22/disabling-dpi-scaling-on-windows-8-1-the-enterprise-way.aspx  (this trick is supposed to work on a per-application basis by calling out the executable by its full path)

BTW:  Microsoft was made aware of this issue a while back, and labeled this as a "Won't Fix" bug:
https://connect.microsoft.com/VisualStudio/feedbackdetail/view/976183/windows-forms-designer-dpi-scaling-problems

The other thing I noticed is the default resolution for the Surface is 2160x1440 (or an aspect ratio of 3:2, which is unusual).  There is no other resolution you can pick in the settings that properly fills the display area of the Surface without letter-boxing on either the sides or the top and bottom.  So for now I'm using a docking station with a miniHDMI -> DVI adapter and a 21" monitor at 1680x1050 resolution for my actual development, and for reading any fine text, and have other things running on the native screen.  The extra work on the Surface occasionally causes it to draw more power than the docking station can supply and it actually discharges the battery under heavy usage (think anything graphics intensive and/or CPU intensive, like full-screen Netflix and number crunching behind the scenes), but when the CPU level drops, the battery starts charging again.

Other people have also noticed that the top right rear of the Surface gets quite hot (given that's where the on-board miniHMDI port is, I'm guessing it's the graphics components), and when it does it slows down a bit.  Having a small fan gently blowing at the back of the Surface helps, so I took an old case fan and have it run via USB power (which is 5V instead of the 12V it wants, but it's MUCH quieter that way, and it's still enough air to keep things at a tolerable temperature).

Oh, and if you do buy a Surface Pro 3, note that BitLocker is ON BY DEFAULT!  Export your recovery keys so that you can get back into your hard-drive in case something happens or you decide to venture into Windows 10 when it comes out later next month (July 2015).