我继承CSplitterWnd类,创建了切分视图,想在分割条上加一图标以实现点击该图标来隐藏或显示切分视图,怎么实现,跪求解决方法!!!

解决方案 »

  1.   

    派生一个子类,重载下面这个函数,想画什么,全在你呀CSplitterWnd::OnDrawSplitter
    virtual void OnDrawSplitter( CDC* pDC, ESplitType nType, const CRect& rect );ParameterspDCA pointer to the device context in which to draw. If pDC is NULL, then CWnd::RedrawWindow is called by the framework and no split window is drawn.nTypeA value of the enum ESplitType, which can be one of the following: splitBox   The splitter drag box.
    splitBar   The bar that appears between the two split windows.
    splitIntersection The intersection of the split windows. This element will not be called when running on Windows 95.
    splitBorder   The split window borders. 
    rectA reference to a CRect object specifying the size and shape of the split windows.ResThis member function is called by the framework to draw and specify the exact characteristics of a splitter window. Override OnDrawSplitter for advanced customization of the imagery for the various graphical components of a splitter window. The default imagery is similar to the splitter in Microsoft Works for Windows or Microsoft Windows 95, in that the intersections of the splitter bars are blended together.For more on dynamic splitter windows, see "Splitter Windows" in the articleMultiple Document Types, Views, and Frame Windows in Visual C++ Programmer’s Guide, Technical Note 29, and the CSplitterWnd class overview.
      

  2.   

    我写了这个函数,怎么我画的时候没有显示呢?
    void CMySplitter::OnDrawSplitter(CDC* pDC, ESplitType nType, const CRect& rectArg)

    CBitmap bt;
    bt.LoadBitmap(IDB_TRIANGLE1);
    BITMAP bitmap;
    bt.GetBitmap(&bitmap);
    CBrush bh(&bt);
    CRect rt;
    rt = rectArg;
    //GetClientRect(&rt);
    if (pDC == NULL)
    {
    RedrawWindow(rectArg, NULL, RDW_INVALIDATE|RDW_NOCHILDREN);
    return; 
    }
    if( nType == splitBar )
    {
    pDC->FillRect(rt,&bh);
    }
    bt.Detach();
    CSplitterWnd::OnDrawSplitter(pDC,nType,rectArg);
      

  3.   

    还还是重写OnPaint,在OnPaint中画吧
      

  4.   

    呵呵,刚才就是重载了OnPaint而没有写东西,OnPaint覆盖了OnDrawSplitter,所以没有显示。
    还有就是m_cxBorderShare (按下鼠标时splitter拖动条的偏移量)要设成0才可以正常显示。
    CSplitterWnd没有Ondraw这个虚函数,OnDrawSplitter应该就相当于OnDraw吧。