Change the coordinate system of a Canvas in WPF

后端 未结 8 1854
一整个雨季
一整个雨季 2021-02-01 06:59

I\'m writing a mapping app that uses a Canvas for positioning elements. For each element I have to programatically convert element\'s Lat/Long to the canvas\' coordinate, then

8条回答
  •  自闭症患者
    2021-02-01 07:16

    Here's an answer which describes a Canvas extension method that allows you to apply a Cartesian coordinate system. I.e.:

    canvas.SetCoordinateSystem(-10, 10, -10, 10)
    

    will set the coordinate system of canvas so that x goes from -10 to 10 and y goes from -10 to 10.

提交回复
热议问题