What is the difference between GetClientRect and GetWindowRect in WinApi?

前端 未结 4 1707
灰色年华
灰色年华 2020-12-08 07:02

What of these should I use in InvalidateRect to refresh my window? And why?

4条回答
  •  南方客
    南方客 (楼主)
    2020-12-08 07:50

    A very simple explanation is that GetWindowRect() gives you the rectangle that includes the borders of the window. GetClientRect() gives you the rectangle that excludes the borders - the area that is allocated to the window specific drawing.

    Please note that GetWindowRect() returns a rectangle in screen coordinates - coordinates that are relative to the screen/monitor. GetClientRect() returns a rectangle that is relative to itself.

提交回复
热议问题