zoukankan      html  css  js  c++  java
  • How to keep Z-order of a control in MFC dialog?


    it starts driving me nuts, but I cann't figure out how to keep position of a child control in a z-order. At design time in MFC dialog resource editor I have STATIC control (descendant of CStatic) at the bottom (tab order Nr. 1), ie. it's overlapped by other controls like buttons, listbox etc.

    At runtime, dialog handles WM_TIMER message and in OnTimer handler there gets the STATIC control moved:

    void CTestMFCDlg::OnTimer(UINT_PTR nIDEvent)
    {
      ...
      m_stMyStatic.SetWindowPos(&this->wndBottom, xpos, ypos, 0, 0, SWP_NOSIZE);
      ...
    }

    After the call of SetWindowPos for the sublassed CStatic control, it's drawed over other controls in a dialog, no matter what I'm passing in the first argument.

    Any idea how to keep the control at the bottom of Z-order all the time ?






    The answer is plain simple. I did just overlooked one flag in SetWindowPos documentation. To prevent z-order changing just pass SWP_NOZORDER flag, so the function call should look like:

    m_stMyStatic.SetWindowPos(NULL, xpos, ypos, 0, 0, SWP_NOSIZE | SWP_NOZORDER); 

  • 相关阅读:
    摄像机
    变换
    纹理
    从顶点数据中传入顶点位置和顶点颜色
    使用glew和glad 新建窗口
    openGL坐标系
    glViewport函数用法
    彻底搞懂CSS文本、空白换行问题
    Django 搭建
    HessianSharp如何部署到IIS7上?
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13318526.html
Copyright © 2011-2022 走看看