Hintergrundfarbe eines ReadOnly-Editfeldes???



  • Wie kann ich die Hintergrundfarbe eines ReadOnly-Editfeldes ändern. Bei einem normalen Editfeld funktioniert folgender Code problemlos:

    HBRUSH CRechKoeKlMal::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) 
    {
     HBRUSH hbr; 
    
     switch (nCtlColor) 
     { 
      case CTLCOLOR_EDIT:   
      case CTLCOLOR_MSGBOX:  
       switch (pWnd->GetDlgCtrlID())  
       {     
        case IDC_ERG: // first CEdit control ID
         // put your own CONTROL ID here    
         pDC->SetBkColor(m_bluecolor); // change the background color
         pDC->SetTextColor(m_textcolor); // change the text color
         hbr = (HBRUSH) m_bluebrush; //  apply the brush
        break;   
    
        case IDC_FAKTOR2: // second CEdit control ID
         // put your own CONTROL ID here    
         pDC->SetBkColor(m_redcolor); // change the background color
         pDC->SetTextColor(m_textcolor); // change the text color
         hbr = (HBRUSH) m_redbrush; // apply the brush
        break;   
    
         // otherwise do default handling of OnCtlColor
        default:    
         hbr=CDialog::OnCtlColor(pDC,pWnd,nCtlColor); 
        break;  
       }  
      break; 
    
      // otherwise do default handling of OnCtlColor
      default:  
       hbr=CDialog::OnCtlColor(pDC,pWnd,nCtlColor); 
     }
    
     return hbr; // return brush
    }
    

    mfg
    Fink Christoph



  • AFAIK sendet ein readonly editfeld nicht als CTLCOLOR_EDIT, sondern als CTLCOLOR_STATIC



  • Original erstellt von dEUs:
    AFAIK sendet ein readonly editfeld nicht als CTLCOLOR_EDIT, sondern als CTLCOLOR_STATIC

    Was ist AFAIK 😕 ?????????



  • Was AFAIK ist weiß ich immer noch nicht aber deine Message hat mich auf die richtige Spur gebracht und es funzt jetzt problemlos.
    Danke!!!!

    mfg
    Fink Christoph



  • AFAIK = As Far As I Know

    wär mal was für die FAQ oder ?

    Devil


Anmelden zum Antworten