AnkhSVN2019
AnkhSVN2019 copied to clipboard
Lock dialog problem on 4K screen, buttons missing
If Visual Studio is showing on a 4K display the Lock dialog layout is drawing some parts of it visual content out side the visual aread including OK and Cancel button. If you move Visual Studio to a smaller display be fore triggering the Lock dialog it works at expected
Note: Window 10 , Display scale set to 100% for 4k screen and 125% for the smaller screen both screen connect to the pc all time
Actually this seems unrelated to 4K. Instead the problem seems to be trigger when Visual Studio is shown on any but the primary screen and the primary screen has a higher scale than the other screens (125% vs 100%)
That rings a bell for me.
Visual Studio 2019 introduces a feature called Per-Monitor Awareness. There is some information about this feature in this article in the documentation and in this blog posting.
This feature actually broke AnkhSVN, so that the tool windows were empty. There is a good article about this problem from JetBrains. It seems that ReSharper had the same problem.
I am absolutely not an expert on this, and for AnkhSVN I took the easy way out added the call
SetThreadDpiAwarenessContext ( NativeImports.DPI_AWARENESS_CONTEXT.SystemAware ) ;
to the constructor for AnkhToolWindowPane, which is the base type for the tool windows in AnkhSVN. This solves the problem, but it means that AnkhSVN is not support per-monitor DPI awareness. I doubt if I am ever going to add that support.
I was not aware that there was a similar problem regarding modal dialogs, but there might be.
If I recall correctly, for DPI-Awareness in a WinForms Dialog, you have to set the property AutoScaleMode=Font. I have just checked this in the LockDialog form, and that property is set.
After googling the problem I have found some information relating to WinForms in this article from Microsoft and this answer on stack overflow.
I'm sure that this problem can be fixed, but it requires some intellectual energy to understand the issues involved.
There is another approach, which is to rewrite the dialog using WPF instead of WinForms. If the problem only relates to the LockDialog, that would be quite an attractive option. So far as I know, WPF is DPI-Aware out of the box.
If the problem applies to every WinForms dialog in AnkhSVN, and if there is a relatively simple fix, then that would be the way to go.
I am only sporadically working on AnkhSVN, but I will try to fix this problem soon.