在CEditView的OnDraw()中处理可以吗?

解决方案 »

  1.   

    editCtrl = pEditView->GetEditCtrl() ;
    editCtrl.SetWindowText( csYourString ) ;
      

  2.   

    关于能够进行多行等大量文字处理的文本框,以使用SetSel、ReplaceSel为佳。
    CEdit edit1 = pEditView->GetEditCtrl() ;
    edit1.SetSel(nStartChar,nEndChar);
    edit1.ReplaceSel(lpszNewText);
      

  3.   

    hujun614(胡均)终于说了一点人话了,不过还是不够简洁:
    CEdit edit1 = pEditView->GetEditCtrl() ;这句肯定不正确
    要么CEdit * pEdit = pEditView->GetEditCtrl();
    要么CEdit & edit = pEditView->GetEditCtrl();
    然后:
    edit.SetWindowText((const char *)YourString);
      

  4.   

    thank you!
    是这样的:
    我在一个对话框中有个指针变量m_pParent指向这个对话框的父窗口,父窗口包含一个editview,
    如何用m_pParent设置这个editview中的文字,用setwindowtext只能设置这个窗口的标题
    怎么办?大家应该明白我的意思吧
      

  5.   

    同意lanzhengpeng2(兰征鹏)
    To:cool99
    要先获得EditView中编辑窗口的指针,然后再SetWindowText()
      

  6.   

    thank you
    to ILoveProgram:
    如何用指针变量m_pParent获得EditView中编辑窗口的指针,
    我用lanzhengpeng2的方法,先声明pEditView,为何总提示:
    d:\vc\register\registerview.h(21) : error C2143: syntax error : missing ';' before '*'
       这行的代码为public:
    CRegisterDoc* GetDocument();你能不能说详细一点?
      

  7.   

    To:cool99() 
    在你的RegisterView类头文件里包含文档头文件,如:
    #include "RegisterDoc.h"试试看吧
      

  8.   

    为什么我一在另外一个对话框中的cpp文件加上
    #include "RegisterView.h"
    就出现这样提示:
    d:\vc\register\registerview.h(21) : error C2143: syntax error : missing ';' before '*'
    d:\vc\register\registerview.h(21) : error C2501: 'CRegisterDoc' : missing storage-class or type specifiers
    d:\vc\register\registerview.h(21) : error C2501: 'GetDocument' : missing storage-class or type specifiers
    出错的代码同上
    why?
      

  9.   

    to ILoveProgram:
    m_pParent是一个cwnd的指针变量
    提示:
    D:\VC\register\RegisterDlg1.cpp(97) : error C2039: 'GetEditCtrl' : is not a member of 'CWnd'
    怎么办?
      

  10.   

    转换一下:
    (CEditView*)m_hParent
      

  11.   

    转换一下:
    (CEditView*)m_hParent
      

  12.   

    我的意见不一定正确
    CEdit毕竟是CWin
    所以可以定义一个CFont
    CEdit->SelectObject(&myFont)
      

  13.   

    我的代码如下:
    CEdit* pedit=((CRegisterView*)m_pParent)->GetEditCtrl();
    pedit->SetWindowText (str);
    提示:
    D:\VC\register\RegisterDlg1.cpp(98) : error C2440: 'initializing' : cannot convert from 'class CEdit' to 'class CEdit *'如果代码改成
    ((CRegisterView*)m_pParent)->SetWindowText (str);
    结果还是只能设置这个窗口的标题,却不能设置这个editview中的文字
    CRegisterView是CEditView类
    why?真是急死我也!
      

  14.   

    To:cool99
    把*去掉
    CEdit &pedit=((CRegisterView*)m_pParent)->GetEditCtrl();
      

  15.   

    to ILoveProgram:
    把*去掉,也不行,
    结果还是只能设置这个窗口的标题,却不能设置这个editview中的文字
    why?
      

  16.   

    To:cool99
    老兄啊,你
    这样,你把程序贴出来,包括你的m_hParent怎么获得的,在什么事件中处理的,然后我再看看
      

  17.   

    解决了
    thank you very much!
      

  18.   

    To:cool99
    恭喜不过别忘了给分,哈哈