怎样将其它类里的CString m_pstr传给CView类里的CString str?并显示? CView::str = m_pstr这种方法只能当CView中的str是静态成员变量才可以用可以先得到CXXXView的指针再赋值不过你为什么不把你的类做为View的成员变量呢 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 CView::str又不是静态变量。赋值可以先得到CView的指针,再将值传递过去,显示用TextOut(...). CString类的变量能直接赋值吗? 看看它的操作符吧?可以有这么多种类型呢CString::operator =const CString& operator =( const CString& stringSrc );throw( CMemoryException );const CString& operator =( TCHAR ch );throw( CMemoryException );const CString& operator =( const unsigned char* psz );throw( CMemoryException );const CString& operator =( LPCWSTR lpsz );throw( CMemoryException );const CString& operator =( LPCSTR lpsz );throw( CMemoryException ); CString类的变量能直接赋值吗?Of course can:CString str="MyStr";You can create a member: CView::SetYourStr(CString str){ strYourStr=str;}and in your class use SetYourStr().I think you made wrong in accessing CView,but not CString itself. 位图的一点小问题,老师们帮忙看看,多谢 MFC 如何对已有的位图进行再绘图 麻烦各位大侠 ,推荐个完整,稳定的,不粘包的 ,完成端口的例子或者封装类 ,源码或者链接 ,谢谢了!!!!!!!!!!!!!!!!!! 问一个菜菜的问题 呵呵,我穷啊!估计没有比我更穷的啦 mfc的Dll创建向导创建的regular dll 和mfc extension dll有什么区别? 如何学好VC? 初学者编译时的问题 60 图像显示技术难题请教*** 请教View框架程序作为子进程运行时,如何自动执行某菜单? SETWINDOWTEXT是怎么用的??? 怎么向isapi传递参数?
赋值可以先得到CView的指针,再将值传递过去,显示用TextOut(...).
CString::operator =
const CString& operator =( const CString& stringSrc );
throw( CMemoryException );const CString& operator =( TCHAR ch );
throw( CMemoryException );const CString& operator =( const unsigned char* psz );
throw( CMemoryException );const CString& operator =( LPCWSTR lpsz );
throw( CMemoryException );const CString& operator =( LPCSTR lpsz );
throw( CMemoryException );
Of course can:
CString str="MyStr";You can create a member:
CView::SetYourStr(CString str)
{
strYourStr=str;
}
and in your class use SetYourStr().I think you made wrong in accessing CView,but not CString itself.