FormsMap Control and HighDPI settings

Within this forum we want to offer discussions all around our .NET based Map control including all .Net-language specific questions concerning calls of the xServer-API. Attention: xServer-relevant concepts can be found in further forums such as xRoute or xTour.

FormsMap Control and HighDPI settings

Postby Oliver Heilig » Mon Dec 11, 2017 3:12 pm


some customers have reported issues with the xServer.NET FormMap control and HighDPI displays. Whenever the Map is displayed, the complete application gets scaled weirdly. I've digged into this issue and found that this can be reproduced simply by adding the Standard WinForms ElementHost-Control to the application. This control used to host the internal Map (which is based on WPF).

I could resolve this issue by making the main application DPI-aware, these two methods both worked for me:

  1. Add an manifest for the application, by "Add new Item" -> "Application Manifest File". Then a manifest file is created where you can add a dpiAware section. You can just remove the comment in the created app.manifest file: xml code
    <!-- Indicates that the application is DPI-aware and will not be automatically scaled by Windows at higher
    DPIs. Windows Presentation Foundation (WPF) applications are automatically DPI-aware and do not need
    to opt in. Windows Forms applications targeting .NET Framework 4.6 that opt into this setting, should
    also set the 'EnableWindowsFormsHighDpiAutoResizing' setting to 'true' in their app.config. -->
    <application xmlns="urn:schemas-microsoft-com:asm.v3">
    <dpiAware xmlns="">true</dpiAware>
  2. Another method is to call the function SetProcessDPIAware() in your Main() method: csharp code
    static void Main() {
    if (Environment.OSVersion.Version.Major >= 6)

    private static extern bool SetProcessDPIAware();

I hope this resolves these issues for your application. You can find the stackoverflow thread about this topic here: ... -setting-e

Oliver Heilig
Chief Developer Logistic Services
PTV GROUP - Germany
User avatar
Oliver Heilig
Posts: 127
Joined: Tue May 13, 2014 12:10 pm
Location: Karlsruhe, Germany

Return to PTV xServer.NET (Admin=OH)