WinAPI C++: Reprogramming Window Resize

后端 未结 5 1869
無奈伤痛
無奈伤痛 2020-12-30 16:15

I have a window, and I want to implement the borders as resizing borders, like any other window. Taking in suggestions from comments and answers, I have rewritten my code. F

5条回答
  •  北荒
    北荒 (楼主)
    2020-12-30 16:51

    It would be helpful to see your code that is changing the window size and position.

    When you move the bottom or right sides, you're only changing the size of the window (height or width). When you move the top or left sides, you have to change not only the size but also the top/left corner position.

    If someone wants to move the left border to the right by 10 pixels, then you have to increase the corner position by 10 and reduce the width by 10 - preferably at the same (e.g. using SetWindowPos for both changes at the same time).

    Note that changing the that corner position also changes how the screen coordinates of the mouse are interpreted. So any storing of the old position would also have to be updated.

提交回复
热议问题