1>------ 已启动生成: 项目: carry, 配置: Debug Win32 ------
1>生成启动时间为 2011-5-26 15:32:00。
1>InitializeBuildStatus:
1>  正在对“Debug\carry.unsuccessfulbuild”执行 Touch 任务。
1>ClCompile:
1>  所有输出均为最新。
1>  stdafx.cpp
1>  carryDlg.cpp
1>d:\my documents\visual studio 2010\projects\carry\carry\carrydlg.cpp(183): error C2679: 二进制“-=”: 没有找到接受“int”类型的右操作数的运算符(或没有可接受的转换)
1>          f:\vs2010\vc\atlmfc\include\atltypes.h(273): 可能是“void CRect::operator -=(POINT) throw()”
1>          f:\vs2010\vc\atlmfc\include\atltypes.h(274): 或       “void CRect::operator -=(SIZE) throw()”
1>          f:\vs2010\vc\atlmfc\include\atltypes.h(275): 或       “void CRect::operator -=(LPCRECT) throw()”
1>          尝试匹配参数列表“(CRect, int)”时============以上是弹出的错误信息==============
void CcarryDlg::ShowHideW(BOOL bShow)
{
CRect m_DlgRectLarge(0,0,0,0);
CRect m_DlgRectsmall(0,0,0,0); GetWindowRect(&m_DlgRectLarge);
m_DlgRectsmall = m_DlgRectLarge;
m_DlgRectsmall -= 220;     //就是这里自减出错
GetWindowRect(&m_DlgRectLarge);}我在VS2008的MFC代码里就没出错.不知道哪设置错了.哪位朋友帮帮忙解答下.在此先谢鸟!!!!

解决方案 »

  1.   

    CRect类重载的 -= 操作符void operator -=( 
       POINT point  
    ) throw( );
    void operator -=( 
       SIZE size  
    ) throw( );
    void operator -=( 
       LPCRECT lpRect  
    ) throw( );
     
      

  2.   

    [Quote=引用 1 楼 visualeleven 的回复:]
    CRect类重载的 -= 操作符C/C++ codevoid operator -=( 
       POINT point  
    ) throw( );
    void operator -=( 
       SIZE size  
    ) throw( );
    void operator -=( 
       LPCRECT lpRect  
    ) throw( );这几个地方需要重写吗?
      

  3.   

    意思你CRect只重载了那上面几个,你的这个可以写成这样
    m_DlgRectsmall -= 220; //就是这里自减出错
    --》
    m_DlgRectsmall -= CSize(220, 0); 
      

  4.   

    改写成m_DlgRectsmall -= CSize(220, 0); 不出错了.
    但是不能用"-="是不是
    void operator -=(  
      POINT point   
    ) throw( );
    void operator -=(  
      SIZE size   
    ) throw( );
    void operator -=(  
      LPCRECT lpRect   
    ) throw( );
    这里出了问题?
      

  5.   

    类型不一致嘛,怎么减?要减的话-=后面的要是上面POINT SIZE LPCRECT的一种,你的明显是int嘛。或者你用DlgRectsmall.Width() 和DlgRectsmall.Height()得到宽和高再-200