I want to position a modal dialog (progress window) at the top right corner of the parent window client area.
This code will put it in the corner of the non-client area, but how do I calculate the offset to the client area?
this.Owner=owner;
this.Left=owner.Left+owner.ActualWidth-Width;
this.Top=owner.Top;
Edit:
I found this 'solution' that works for normal windows:
this.Left=owner.Left+owner.ActualWidth-Width-SystemParameters.ResizeFrameVerticalBorderWidth;
this.Top=owner.Top+SystemParameters.ResizeFrameHorizontalBorderHeight+SystemParameters.WindowCaptionHeight;
This would however fail for windows that have customized borders.
EDIT:
The code should work regardless of the systems DPI setting (e.g. 120 instead of 96).