To solve blurry fonts in running mode (crisp in design mode) in windows 10 caused by VS 2013 does not have DPI awareness ability for developed apps:
(1) in Module.vb, add the following code at the top:
Imports System.Runtime.InteropServices
Module Module1
Public Declare Function SetProcessDpiAwarenessContext Lib "user32.dll" (ByVal dpiFlag As Integer) As Boolean
Public Declare Function SetProcessDpiAwareness Lib "SHCore.dll" (ByVal awareness As PROCESS_DPI_AWARENESS) As Boolean
Public Declare Function SetProcessDPIAware Lib "user32.dll" () As Boolean
Friend Enum PROCESS_DPI_AWARENESS
Process_DPI_Unaware = 0
Process_System_DPI_Aware = 1
Process_Per_Monitor_DPI_Aware = 2
End Enum
Friend Enum DPI_AWARENESS_CONTEXT
DPI_AWARENESS_CONTEXT_UNAWARE = 16
DPI_AWARENESS_CONTEXT_SYSTEM_AWARE = 17
DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE = 18
DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2 = 34
End Enum
Public Sub Main()
Application.EnableVisualStyles()
Dim s() As String = System.Runtime.InteropServices.RuntimeInformation.OSDescription.Split(" ")
Dim OSver As String = s(2)
Dim curVer As New Version()
If Version.TryParse(OSver, curVer) Then
'Note: the three of the following methods work with Windows 10, however SetProcessDpiAwarenessContext is the best
If curVer >= New Version(6, 3, 0) Then ' win 8.1 added support for per monitor dpi
If curVer >= New Version(10, 0, 15063) Then ' win 10 creators update added support for per monitor v2
SetProcessDpiAwarenessContext(DPI_AWARENESS_CONTEXT.DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2)
Else
SetProcessDpiAwareness(PROCESS_DPI_AWARENESS.Process_Per_Monitor_DPI_Aware)
End If
Else
SetProcessDPIAware()
End If
Debug.Print(curVer.ToString)
End If
Application.SetCompatibleTextRenderingDefault(False)
Application.Run(Form1)
End Sub
End Module
(2) From Project Properties->Appication, uncheck "Enable application framework"
'and select Startup object as "Sub Main"
The following solution worked for VS 2017:
open app.mainfest by Project Properties->Application->View Windows Settings
add the Windows-10 compatibility code to app.mainfest inside block
<!-- Windows 10 compatibility -->
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />
Also add the following code after block
<application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings>
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
</windowsSettings>
</application>