CDialogBar窗口的悬浮设置

gy2006_sw

关注

阅读 68

2023-04-28


(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之前,问题就可以解决了!

精彩评论(0)

0 0 举报