子控件Z-ORDER顺序 :置顶、置底

版权声明:本文为博主原创文章,未经博主允许不可以转载。 https://blog.csdn.net/aasmfox/article/details/80605100

调整子控件的Z-ORDER顺序,可以使用SetWindowPos这个函数

一。SetWindowPos

BOOL SetWindowPos(
  HWND hWnd,             // handle to window
  HWND hWndInsertAfter,  // placement-order handle
  int X,                 // horizontal position
  int Y,                 // vertical position
  int cx,                // width
  int cy,                // height
  UINT uFlags            // window-positioning options
);

关键的参数

hWndInsertAfter

HWND_BOTTOM  

HWND_NOTOPMOST

HWND_TOP

HWND_TOPMOST

如图:选择一个按钮置顶时的操作:

::SetWindowPos(m_hFocus,HWND_TOP,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE|SWP_FRAMECHANGED);



猜你喜欢

转载自blog.csdn.net/aasmfox/article/details/80605100