1

I'm trying to figure out how I can temporarily disable DPI awareness in a WPF-application to set Window Placement. Following this example

I'm essentially trying to run the following from my Window's code behind:

DPI_AWARENESS_CONTEXT previousDpiContext = SetThreadDpiAwarenessContext(DPI_AWARENESS_CONTEXT_UNAWARE);
BOOL ret = SetWindowPlacement(hwnd, wp);
SetThreadDpiAwarenessContext(previousDpiContext);

But I can't figure out how this would work with interop. I have set up some basic Window Placement interop using the example here

Igor Cova
  • 3,126
  • 4
  • 31
  • 57
ymbcKxSw
  • 315
  • 4
  • 10
  • 1
    Pretty doubtful that this is what you really want to do. Google "wpf convert inches to pixels" for possible solutions. – Hans Passant Jul 18 '18 at 22:33
  • Typically, WPF is pretty much DPI aware - or should be. It's often different for WinForms, and some components might also have DPI issues. – Andreas Reiff Apr 22 '20 at 07:39

0 Answers0