如题,哪个按钮被点击了,他的效果就与其它按钮区别。试了CButton的属性,感觉效果都不好。

解决方案 »

  1.   

    用CButtonST试试能不能满足你的要求http://www.codeproject.com/KB/buttons/cbuttonst.aspx
      

  2.   

    自绘一个按钮,在drawItem中,效果可以自己定制,你可以在按下的时候,换一张贴图,也可以是按钮的客户区域缩小一个像素!
      

  3.   

    大家说vc做界面好不好啊,我是觉得Delphi, c++Builder方便很多
      

  4.   

    Delphi, c++Builder方便很多
    //是的
    vc做界面好不好
    //有很多的界面库,功能很强。
      

  5.   

    自绘,贴图,按下和正常的两张图片。可以用一些界面控件或者界面库,现成的界面库有BCG、XTP等。
      

  6.   

    自绘控件.MSDN中有Subclass control,可以参考一下。
    vc做界面是不怎么好,但如果自己学着做,不也能学到很多东西吗?
      

  7.   

    MSDN中的例子:An owner-drawn button has the BS_OWNERDRAW style set. Override this member function to implement drawing for an owner-drawn CButton object. The application should restore all graphics device interface (GDI) objects selected for the display context supplied in lpDrawItemStruct before the member function terminates.
    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);
    }
      

  8.   

    纠正一个误区,好多人一想到这个就是自绘,我看过一些公司的程序,都是花老大劲自绘,浪费时间、浪费资源,程序也让人读起来费劲.
    其实VC有现成的按扭:Check,Radio都是,加入上述控件,在属性页将push-like选上, 就是3态按扭
      

  9.   

    简单点可用 推式 的CheckBox代替
      

  10.   

    利用CButtonST给你的按钮换图片,图片为你想要的效果,按钮的一个状态使用一个图片。
      

  11.   

    其实我是想标示当前哪个按钮被选中阿,我又很多按钮的,其中一个按钮选中后,他的子对话框上也有按钮,选子对话框的按钮后,原来那个按钮就失去焦点了阿,我就不知道当前在哪个页了,CButtonST是个好东西,但我不想用平面按钮
      

  12.   

    自绘的比较麻烦,试试DHtml?
    http://blog.csdn.net/IamNieo/archive/2008/09/01/2860115.aspx