My application is System DPI aware and I would like to have some parts of UI (some child controls) to be bitmap scaled by OS, since we do not want them to be Highdpi aware.
It is possible to set secondary dialogs/windows to be DPI Unaware and that works as expected. But is it possible to do the same for child controls which are docked?
This is the sample code I tried, but the child control(sampleContainerControl) is created as System Aware only.
SetThreadDpiHostingBehavior(DPI_HOSTING_BEHAVIOR.DPI_HOSTING_BEHAVIOR_MIXED);
DPI_AWARENESS_CONTEXT previousDpiContext = SetThreadDpiAwarenessContext(DPI_AWARENESS_CONTEXT.DPI_AWARENESS_CONTEXT_UNAWARE);
sampleContainerControl = new SampleContainerControl();
sampleContainerControl.Text = "Bitmap scaling Controls Editor";
sampleContainerControl.Dock = DockStyle.Fill;
tabPage.Controls.Add(sampleContainerControl);
SetThreadDpiAwarenessContext(previousDpiContext);
Is there anything that I am missing? As per the link below, it should be possible to create a child control in a different DPI mode. https://learn.microsoft.com/en-us/visualstudio/extensibility/ux-guidelines/per-monitor-awareness-extenders?view=vs-2019&viewFallbackFrom=vs-2019Microsoft.VisualStudio.DpiAwareness#test-your-extensions-for-pma-issues
Please share your experiences or thoughts.
(.net version used is 4.8)