如题,当我想重绘出QQ视频图标那样的CBUTTON(应该是CBUTTON吧),怎么弄,我知道在DRAWITEM函数中重绘,但是我老是调用绘图函数不正确! 求代码!         CreateCompatibleDC   、  CreateCompatibleBitmap()  、 bitblt()这几个函数也用不来!  

解决方案 »

  1.   

    参考MSDN文档的CButton类的DrawItem函数中的实现,它有个例子代码的
      

  2.   

    我这有个跟360按钮相似的按钮,这个和QQ的应该差不多...希望对你有帮助。。
    http://download.csdn.net/detail/allen_lanyuhai/3658158
      

  3.   

    void CMyButton::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct) 
    {
       UINT uStyle = DFCS_BUTTONPUSH;   // This code only works with buttons.
       ASSERT(lpDrawItemStruct->CtlType == ODT_BUTTON);   // If drawing selected, add the pushed style to DrawFrameControl.
       if (lpDrawItemStruct->itemState & ODS_SELECTED)
          uStyle |= DFCS_PUSHED;   // Draw the button frame.
       ::DrawFrameControl(lpDrawItemStruct->hDC, &lpDrawItemStruct->rcItem, 
          DFC_BUTTON, uStyle);   // Get the button's text.
       CString strText;
       GetWindowText(strText);   // Draw the button text using the text color red.
       COLORREF crOldColor = ::SetTextColor(lpDrawItemStruct->hDC, RGB(255,0,0));
       ::DrawText(lpDrawItemStruct->hDC, strText, strText.GetLength(), 
          &lpDrawItemStruct->rcItem, DT_SINGLELINE|DT_VCENTER|DT_CENTER);
       ::SetTextColor(lpDrawItemStruct->hDC, crOldColor);
    }
      

  4.   

    参考msdn,把函数的各个参数的类型,函数返回值看懂。