C# WPF resolution independancy?

后端 未结 3 880
遥遥无期
遥遥无期 2020-12-16 16:59

I am developing a map control in WPF with C#. I am using a canvas control e.g. 400 x 200 which is assigned a map area of e.g. 2,000m x 1,000m.

The scale of the map w

3条回答
  •  囚心锁ツ
    2020-12-16 17:48

    Thank you for you prompt reply.

    I totally agree, but I didn't want to believe it in the first place. You see, there has to be an approximate calculation of the scale of the map if the map is used to display different layers of map data (scale dependant). Most applications use a slider control with e.g. 10 discrete map levels to set the "scale".

    Having an absolute scale is not crucial for the application, it would be nice to display an indicative scale, like 1:15,000.

    An absolute scale would require for an extra variable monitorPhysicalDPI (initially set to 96) that if the uses chooses to change would give slightly better scaling (again it's not crucial). The size of the map control would be:

    map.ActualWidth * (96/monitorPhysicalDPI) * inchesPerDIU, inchesPerDIU is 1/96

    Again these are cosmetics.. Wouldn't it be nice if Windows knew the ACTUAL control's dimensions? (user would have to give information about the screen dimensions on OS setup, or simply installing the monitor INF file)

提交回复
热议问题