Are the WPF Window Position Properties Left, Top, Height, and Width actually doubled?

The WPF window's Left , Top , Height, and Width position properties are pairs. However, when interacting with Windows messages , such as WM_MOVING and WM_MOVE , you need to convert double to an integral type .

This seemed good to me, since all Windows notifications seem to use integral types in all arguments of their positions, and I think these messages are closely related to WPF properties.

So, the question is, am I correct in this assumption, or can it be that the notifications on the windows are actually doubled, and in the end there will be some strange side effect?

+1
source share
2 answers

In WPF windows, these properties are actually mapped to the position of the Window, which, as you noted (on Windows), will ultimately map to an integer value.

However, they are defined as doubles, which is nice because they clearly display (and inherit) other properties of the FrameworkElement, that is: FrameworkElement.Width . Elements in the window use double precision because they are designed for independent resolution and allow arbitrary scaling through Transform, etc.

, Window FrameworkElement , FrameworkElement. , . , , - API Windows , () .

+3

, , .

(, 0,5 ), . , : 100 3, (, , ).

, , int , .

+2

Source: https://habr.com/ru/post/1790546/


All Articles