0

I have WinForms with TableLayoutPanel with rows divided by %/pixels inside Toolstrips and other stuff. Problem comes if monitor 4K and scale is set higher than 175%, some layouts rows not properly resize, buttons or toolstrip are barely visible.

Manually I can fix this, but same fix is not suitable for 100% and 200% scale, so I need IF's.

So main question is how to get each monitor scale %? Or at least scale % on that monitor were it was loaded.

Charlieface
  • 52,284
  • 6
  • 19
  • 43
bankeris
  • 181
  • 10
  • 1
    Read the notes here: [Using SetWindowPos with multiple monitors](https://stackoverflow.com/a/53026765/7444103) about `GetScaleFactorForMonitor()`; as described`[Screen].GetHashCode()` returns the `HMONITOR` (Handle of a Monitor) that can be used in the function call. Or use `MonitorFromWindow()` or `MonitorFromPoint()` instead -- The scale of the Monitor is not enough, the Font can also be scaled. Your app needs to be DpiAware and handle Font scale on its own terms. A DpiAware application receives Dpi change notifications (a Control can handle `DpiChangedAfterParent`) – Jimi Aug 16 '22 at 19:44
  • Thanks for reply @charlieface, C-Pound Guru and Jimi. Similar question almost solves my question as I can get scaling factor for each monitor. DpiAware probably wont help me due I'm on .net 3.5, but thanks for link. Very interesting post. – bankeris Aug 17 '22 at 08:00

0 Answers0