RichTextCtrl
-
hi i have placed a RichTextControl in a dialogbox.i want to know some code about it 1.when i press enterbutton after adding some text in it cursor is not going to next line 2.how to write code for SetSelBold() and SetSelColor() and all these functions? 3.i'm giving the file name at runtime in my InitDialog() as below ::OnInitDialog() { CString str; str = "D:\\Bose\\Opms\\src\\"; str += pDoc->GetModelTextName(); str += ".prs"; VARIANT var; InitVariant(&var); m_RichText.Loadfile(str,&var); } when i run my program it giving "The specified file/path is invalid"message. how to avoid it? please help me if anybody know code for it
-
hi i have placed a RichTextControl in a dialogbox.i want to know some code about it 1.when i press enterbutton after adding some text in it cursor is not going to next line 2.how to write code for SetSelBold() and SetSelColor() and all these functions? 3.i'm giving the file name at runtime in my InitDialog() as below ::OnInitDialog() { CString str; str = "D:\\Bose\\Opms\\src\\"; str += pDoc->GetModelTextName(); str += ".prs"; VARIANT var; InitVariant(&var); m_RichText.Loadfile(str,&var); } when i run my program it giving "The specified file/path is invalid"message. how to avoid it? please help me if anybody know code for it
Hi 1. catch your enterbutton in BOOL CYourDlg::OnApply() { // do something with m_RichText; return FALSE; } also your can use OnChar(...) fiunction 2. a sample m_RichText.SetSel(0,-1); CHARFORMAT cf; cf.dwMask = CFM_SIZE|CFM_COLOR|CFM_UNDERLINE; cf.dwEffects = CFE_UNDERLINE; cf.crTextColor = RGB( 0, 0,255); cf.yHeight = 120; m_RichText.SetWordCharFormat(cf); 3. the simplest way try { ... m_RichText.LoadFile(..); } catch(...) { } Mike.