CDialogBar窗口的悬浮设置

来源:互联网 发布:游戏 知乎 编辑:程序博客网 时间:2024/04/28 16:27

(1)创建Dialog后将其设置为ToolWindow,其它和CDialogBar要求一样

(2)在OnCreat里添加代码

         if (!m_Bar.Create(this, IDD_HISTOGRAM,CBRS_LEFT , ID_VIEW_HISTOGRAM))

        {
            TRACE0("Failed to create dialog bar/n");
             return -1;      // fail to create
        }
        CString Caption;
        Caption.Format("%s","Histogram"); 
        m_Bar.SetWindowText(Caption);

        CRect rFrame;
        GetWindowRect(rFrame);
        int x = rFrame.right - 340;
        int y = rFrame.top + 90;

        

        FloatControlBar(&m_HistogramBar, CPoint(x, y), CBRS_ALIGN_TOP);

(3)有时候使用FloatControlBar会出现错误,将

        m_Bar.EnableDocking(CBRS_ALIGN_BOTTOM   |   CBRS_ALIGN_RIGHT);     
        EnableDocking(CBRS_ALIGN_ANY);

        要添加在FloatControlBar之前,问题就可以解决了!

原创粉丝点击