SetWindowPos(...) 的一些注意事项。
前些天在调整控件位置,总是出现非预想的错误。我完全没有注意到msdn关于参数的注释:
其中X,Y 都是对应于 hWndInsertAfter 的 客户区 坐标。也就是说,关于定位的计算,都应该通过GetClientRect。特别是有着边框(Frame)的控件,直接导致GetWindowRect 与 GetClientRect 所得到的长宽不同。
看MSDN要仔细啊,那么细小的问题。
前些天在调整控件位置,总是出现非预想的错误。我完全没有注意到msdn关于参数的注释:
其中X,Y 都是对应于 hWndInsertAfter 的 客户区 坐标。也就是说,关于定位的计算,都应该通过GetClientRect。特别是有着边框(Frame)的控件,直接导致GetWindowRect 与 GetClientRect 所得到的长宽不同。
看MSDN要仔细啊,那么细小的问题。