Radio Button färben



  • Hallöchen, ich suche eine Möglichkeit einen Radio Button einzufärben...
    Hab dieses schon mit OnCtlColor probiert.

    HBRUSH CAirControlSoftView::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) 
    {
    
        HBRUSH hbr = CFormView::OnCtlColor(pDC, pWnd, nCtlColor);
    
        HBRUSH hBGEdit = CreateSolidBrush(RGB(255, 0, 0));
    
        // Element ermitteln, was geändert werden soll.
        if(pWnd->GetDlgCtrlID() == IDC_RADIO3)
        {
          pDC->SetBkMode(RGB(255, 0, 0));
          return hBGEdit;
        }
    
        return hbr;
    }
    

    Hiermit wird aber nur der Hintergrud gefärbt!!! Möchte aber das der Kreis gefärbt wird, es soll eine Art Statusanzeige sein! Ist das irgendwie möglich???
    Oder muss ich einen anderen Weg einschlagen?

    MfG


  • Mod

    Siehe Doku zu WM_CTLCOLORBTN
    http://msdn2.microsoft.com/en-us/library/bb761849.aspx

    By default, the DefWindowProc function selects the default system colors for the button. Buttons with the BS_PUSHBUTTON, BS_DEFPUSHBUTTON, or BS_PUSHLIKE styles do not use the returned brush. Buttons with these styles are always drawn with the default system colors. Drawing push buttons requires several different brushes-face, highlight, and shadow-but the WM_CTLCOLORBTN message allows only one brush to be returned. To provide a custom appearance for push buttons, use an owner-drawn button.

    Hier musst Du zu Ownerdraw greifen!


Anmelden zum Antworten