Search code examples
c#wpfscreen-resolutionresolution-independencewindowsformshost

Fixed pixel-size WinForm Custom control inside WPF full screen application


I try to insert a Winform custom control inside WindowsFormHost. This custom control only works in a fixed height & width.

I try to specify the width & height for this custom control & the WindowsFormHost, but since WPF size is resolution-independent, the control got scaled and ruined the position.

Is there any way I can do to force the size of this custom control in pixel?


Solution

  • Encapsulate the WindowsFormHost within a Canvas, cause with it you can explicitly position child elements by using coordinates that are relative to its area.