error C2677: binary '-' : no global operator defined which takes type 'class CString' (or there is n
来源:互联网 发布:java bigdecimal 比较 编辑:程序博客网 时间:2024/04/28 12:53
下面为MFC中加入的OnPaint()的代码:
CPaintDC dc(this);
CRect rectWnd;CString cstrText;
UINT uFormat;
GetWindowText(cstrText);
dc.SelectObject(GetFont());
CSize size=dc.GetTextExtent(cstrText);
DWORD dwStyle=GetStyle();
GetWindowRect(rectWnd);
uFormat=DT_TOP;
if(dwStyle&SS_NOPREFIX)
uFormat|=DT_NOPREFIX;
dc.Draw3dRect(0,rectWnd.Height()/2,(rectWnd.Width()-size.cx)/2-m_Text,2,::GetSysColor(COLOR_3DSHADOW),::GetSysColor(COLOR_3DHIGHLIGHT));
dc.SetBkMode(TRANSPARENT);
dc.DrawText(cstrText,CRect((rectWnd.Width()-size.cx)/2,0,(rectWnd.Width()-size.cx)/2+size.cx,size.cy),DT_LEFT|DT_SINGLELINE|DT_VCENTER);
dc.Draw3dRect((rectWnd.Width()-size.cx)/2+size.cx,rectWnd.Height()/2,(rectWnd.Width()-size.cx)/2-m_Text,2,::GetSysColor(COLOR_3DSHADOW),::GetSysColor(COLOR_3DHIGHLIGHT));
提示:error C2677: binary '-' : no global operator defined which takes type 'class CString' (or there is n……
我查了一下代码,看了一下我给静态文本控件关联上了变量,而且正确引用了为什么会出错呢?
原来,静态文本控件绑定的变量是字符串类型,而在这里的代码段里需要一个数值类型,所以我在第一段之前加上了一段:
int m_TextConver=atof(m_Text.GetBuffer(0));
编译运行,问题解决
0 0
- error C2677: binary '-' : no global operator defined which takes type 'class CString' (or there is n
- 解决 C++错误 error C2679: binary '=' : no operator defined which takes a right-hand operand of type 'class CString' (or there is no
- error C2679: binary '<<' : no operator defined which takes a right-hand operand of type '' (or there is no acceptable conversion
- error C2679: binary '<<' : no operator defined which takes a right-hand operand of type '' (or there is no acceptable conversion
- error C2679: binary '<<' : no operator defined which takes a right-hand operand of type 'class Stude
- error C2678: binary '>>' : no operator found which takes a left-hand operand of type 'std::
- error C2679: binary '<<' : no operator found which takes a right-hand operand of type 'std::wstring'
- error C2679: binary '<<' : no operator found which takes a right-hand operand of type 'std::string'
- error C2679: binary '<<' : no operator found which takes a right-hand operand of type 'std::string'
- error C2679: binary '<<' : no operator found which takes a right-hand operand of type 'std::wstring'
- 错误1error C2679: binary '<<' : no operator found which takes a right-hand operand of type 'std::str
- C++,如何输出string类型的数据(报错:no operator defined which takes a right-hand operand of type 'class std::bas)
- Error1error C2679: binary '>>' : no operator found which takes a right-hand operand of type 'std::
- C2679: binary '<<' : no operator found which takes a right-hand operand of type 'const std::basic
- error C2679: binary ',class std::allocator >' (or there is no accept
- Struts2 使用ajax访问action,返回json格式数据,提示error:There is no result type defined for type 'json'
- 错误积累(二) There is no result type defined 错误
- struts2 配置错误There is no result type defined for type 'json'
- PinyinIME源码NDK编译的问题
- (转载)MTK GPIO操作:http://www.52rd.com/Blog/Detail_RD.Blog_maliping_26051.html
- 用erlang打造系统级监控工具
- 寻找自适应元素(8)-透视表的日期组合
- Java的位运算
- error C2677: binary '-' : no global operator defined which takes type 'class CString' (or there is n
- C++ 文件结束符
- java nio socketChannel read返回值代表的意思
- 安装Dahdi模块出现insmod: can't insert 'dahdi.ko': unknown symbol in module or invalid parameter
- 寻找自适应元素(9)-透视表的数字组合
- java.util.ConcurrentModificationException 出现的原因和解决办法
- Android4.4 Telephony流程分析——拨号应用(Dialer)的通话记录加载过程
- 申请美国商务签证(B1/B2) -- 大连
- DLNA中的UPnP技术浅析