Chào mừng đến với Diễn đàn lập trình - Cộng đồng lập trình.
Kết quả 1 đến 4 của 4
  1. #1
    Ngày tham gia
    Sep 2015
    Bài viết
    0

  2. #2
    Ngày tham gia
    Sep 2015
    Bài viết
    0
    Trích dẫn Gửi bởi bkavPro
    Dùng cách nào để thay đổi mầu của 1 vài ký tự trong EditText ?
    Không thể !

    Thử tìm hiểu RichEditText nhá

  3. #3
    Ngày tham gia
    Sep 2015
    Đang ở
    hà nội
    Bài viết
    0
    Mình dùng MFC dialogBase nó không tài nào chạy được thằng CrichEditCtrl
    Bài viết tại đây

  4. #4
    Ngày tham gia
    Sep 2015
    Bài viết
    0
    Hóa ra phải Gọi hàm AfxInitRichEdit2() thì mới sử dụng được,google mãi mới ra
    Ai quan tâm thì đọc thêm tại đây: http://www.codeproject.com/KB/edit/R...px?msg=1674670

    Mã nguồn PHP:
    BOOL CsdjApp::InitInstance(){//TODO: call AfxInitRichEdit2() to initialize richedit2 library. // InitCommonControlsEx() is required on Windows XP if an application // manifest specifies use of ComCtl32.dll version 6 or later to enable // visual styles. Otherwise, any window creation will fail. INITCOMMONCONTROLSEX InitCtrls; AfxInitRichEdit(); InitCtrls.dwSize = sizeof(InitCtrls); // Set this to include all the common control classes you want to use // in your application. InitCtrls.dwICC = ICC_WIN95_CLASSES; InitCommonControlsEx(&InitCtrls); CWinApp::InitInstance(); AfxEnableControlContainer(); // Standard initialization // If you are not using these features and wish to reduce the size // of your final executable, you should remove from the following // the specific initialization routines you do not need // Change the registry key under which our settings are stored // TODO: You should modify this string to be something appropriate // such as the name of your company or organization SetRegistryKey(_T("Local AppWizard-Generated Applications")); CsdjDlg dlg; m_pMainWnd = &dlg; INT_PTR nResponse = dlg.DoModal(); if (nResponse == IDOK) { // TODO: Place code here to handle when the dialog is // dismissed with OK } else if (nResponse == IDCANCEL) { // TODO: Place code here to handle when the dialog is // dismissed with Cancel } // Since the dialog has been closed, return FALSE so that we exit the // application, rather than start the application's message pump. return FALSE;}  
    thay Font và mầu sắc cho CrichEditCtrl:


    Mã nguồn PHP:
    bool InsertColorRichEditCtrl(__in CHARACTER charTemp,__in int iBreakLine){ CHARFORMAT cf; cf.cbSize = sizeof(CHARFORMAT); cf.dwMask = CFM_FACE | CFM_BOLD | CFM_SIZE | CFM_COLOR; cf.dwEffects = 0; cf.crTextColor = 0; lstrcpy(cf.szFaceName, L"Arial"); cf.yHeight = 300; cf.bCharSet = ANSI_CHARSET; cf.bPitchAndFamily = DEFAULT_PITCH; switch(charTemp.iProperty) { case PROPERTY_KEYDOWN: cf.crTextColor = RGB(0, 0, 0); break; case PROPERTY_KEYUP: cf.crTextColor = RGB(255, 0, 0); break; case PROPERTY_KEYCONTROL_DOWN: cf.crTextColor = RGB(0, 0x99, 0); break; case PROPERTY_KEYCONTROL_UP: cf.crTextColor = RGB(0, 23, 255); break; default: break; } DWORD nInsertionPoint = m_richeditctrl.GetWindowTextLength(); m_richeditctrl.SetSel(nInsertionPoint, -1); m_richeditctrl.SetSelectionCharFormat(cf); TCHAR szTCHAR[MAX_CHARACTER]; mbstowcs (szTCHAR, charTemp.szKeyLog,MAX_CHARACTER); m_richeditctrl.ReplaceSel(szTCHAR); return true;}  

 

 

Quyền viết bài

  • Bạn Không thể gửi Chủ đề mới
  • Bạn Không thể Gửi trả lời
  • Bạn Không thể Gửi file đính kèm
  • Bạn Không thể Sửa bài viết của mình
  •