How do I convert a WPF size to physical pixels?
问题 What's the best way to convert a WPF (resolution-independent) width and height to physical screen pixels? I'm showing WPF content in a WinForms Form (via ElementHost) and trying to work out some sizing logic. I've got it working fine when the OS is running at the default 96 dpi. But it won't work when the OS is set to 120 dpi or some other resolution, because then a WPF element that reports its Width as 96 will actually be 120 pixels wide as far as WinForms is concerned. I couldn't find any