如何 重画 vc的 菜单的外边线  
整个menu的外部的边线
和 列表框的外边线
谢谢!

解决方案 »

  1.   

    void xxxMenu::DrawItemBorder(LPDRAWITEMSTRUCT lpdis)
    {
         CRect rItem(lpdis->rcItem);
         CDC* pDC = CDC::FromHandle(lpdis->hDC);      pDC->FillSolidRect(CRect(rItem.left - 1, rItem.top, rItem.left, rItem.bottom), crShadow);
         pDC->FillSolidRect(CRect(rItem.right - 1, rItem.top, rItem.right, rItem.bottom), crShadow);
    }void xxxMenu::DrawItem(LPDRAWITEMSTRUCT lpdis)
    {
          CPaintDC dc(this); // device context for painting

    // prepare dc
    dc.SelectObject(GetFont());

    DRAWITEMSTRUCT dis;
    dis.CtlType = ODT_MENU;
    dis.CtlID = GetDlgCtrlID();
    dis.hwndItem = GetSafeHwnd();
    dis.hDC = dc.GetSafeHdc();
    dis.itemAction = ODA_DRAWENTIRE;

    // draw the rest of the border
    CRect rClient, rPage;
    GetClientRect(&dis.rcItem);
    rPage = dis.rcItem;
    AdjustRect(FALSE, rPage);
    dis.rcItem.top = rPage.top - 2;

    DrawMainBorder(&dis);

    // paint the tabs first and then the borders
    int nTab = GetItemCount();
    int nSel = GetCurSel();

    // now selected tab
    dis.itemID = nSel;
    dis.itemState = ODS_SELECTED;

    VERIFY(GetItemRect(nSel, &dis.rcItem));

    dis.rcItem.bottom += 2;
    dis.rcItem.top -= 2;
    DrawItem(&dis);
    DrawItemBorder(&dis);
    }
      

  2.   

    DrawMainBorder(&dis); 
    里面的 呢 ?
    好像这个代码里面没有 
    麻烦了
      

  3.   

    好像 在这个drwawitem使用  GetClientRect不可以得到 rect
    ? 谢谢指教