龙盟编程博客 | 无障碍搜索 | 云盘搜索神器
快速搜索
主页 > 软件开发 > VC开发 >

使用VC6.0实现窗口的任意分割(4)

时间:2009-12-30 15:42来源:未知 作者:admin 点击:
分享到:
ASSERT_VALID(this); //获得当前的获得焦点的窗口 //下面注释粗体的是原有的代码的主要部分。 // CWnd* pView = NULL; //CFrameWnd* pFrameWnd = GetParentFrame(); //ASSERT_VALID(
                ASSERT_VALID(this);
               //获得当前的获得焦点的窗口
                  //下面注释粗体的是原有的代码的主要部分。
                  // CWnd* pView = NULL;
               //CFrameWnd* pFrameWnd = GetParentFrame();
               //ASSERT_VALID(pFrameWnd);
               //pView = pFrameWnd->GetActiveView();
               //if (pView == NULL)
               // pView = GetFocus();
               CWnd* pView = GetFocus();
               if (pView != NULL && !IsChildPane(pView, pRow, pCol))
                 pView = NULL;
               return pView;
}
         
void CxSplitterWnd::SetActivePane( int row, int col, CWnd* pWnd)
{
                  CWnd* pPane = pWnd == NULL ? GetPane(row, col) : pWnd;
                  //下面加注释粗体的是原有代码的主要部分。
                  //FrameWnd* pFrameWnd = GetParentFrame();
                  //ASSERT_VALID(pFrameWnd);
                  //pFrameWnd->SetActiveView((CView*)pPane);
                  pPane->SetFocus();//修改后的语句
}
         
void CxSplitterWnd::StartTracking(int ht)
{
                  ASSERT_VALID(this);
                  if (ht == noHit)
                          return;
                  // GetHitRect will restrict ''''m_rectLimit'''' as appropriate
         
                  GetInsideRect(m_rectLimit);
                  if (ht >= splitterIntersection1 && ht <= splitterIntersection225)
         
                  {
                          // split two directions (two tracking rectangles)
         
                          int row = (ht - splitterIntersection1) / 15;
         
                          int col = (ht - splitterIntersection1) % 15;
         
                          GetHitRect(row + vSplitterBar1, m_rectTracker);
         
                          int yTrackOffset = m_ptTrackOffset.y;
                          m_bTracking2 = TRUE;
                          GetHitRect(col + hSplitterBar1, m_rectTracker2);
         
                          m_ptTrackOffset.y = yTrackOffset;
                  }
                  else if (ht == bothSplitterBox)
                  {
                  // hit on splitter boxes (for keyboard)
                  GetHitRect(vSplitterBox, m_rectTracker);
                  int yTrackOffset = m_ptTrackOffset.y;
                  m_bTracking2 = TRUE;
                  GetHitRect(hSplitterBox, m_rectTracker2);
                  m_ptTrackOffset.y = yTrackOffset; // center it
                  m_rectTracker.OffsetRect(0, m_rectLimit.Height()/2); m_rectTracker2.OffsetRect(m_rectLimit.Width()/2,
          0);
                  }
                  else
                  {
                  // only hit one bar
                  GetHitRect(ht, m_rectTracker);
                  }
收藏文章
表情删除后不可恢复,是否删除
取消
确定
图片正在上传,请稍后...
评论内容为空!
还没有评论,快来抢沙发吧!
按钮 内容不能为空!
立刻说两句吧! 查看0条评论
精彩图集

赞助商链接