Schriftgöße in einem Textfeld ändern



  • Kann mir jemand sagen, wie ich die Schriftgröße und die Hintergrundfarbe eines Textfeldes festlegen kann. Ich hab mich schon auf die Suche gemacht, aber ich bin irgendwie nicht weiter gekommen wie SetFont.



  • Für die Größe und Art der Schrift ist SetFont genau das Richtige.

    Für die Farbe gibt es die OnCtlColor Finktion.
    Sie via WM_CTLCOLOR??? Message wird vom Child zum
    Elternfenster geleitet.

    z.B.

    HBRUSH CColorDialogDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
    {
    HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
    DWORD id;

    id = GetWindowLong(pWnd->m_hWnd,GWL_ID);

    if(id == IDC_EDIT1)
    {
    pDC->SetTextColor(m_color[m_vg1]);
    pDC->SetBkColor (m_color[m_hg1]);
    return m_brush[m_hg1];
    }

    if(id == IDC_EDIT2)
    {
    pDC->SetTextColor(m_color[m_vg2]);
    pDC->SetBkColor (m_color[m_hg2]);
    return m_brush[m_hg2];
    }

    if(id == IDOK)
    {
    pDC->SetTextColor(m_color[m_vg3]);
    pDC->SetBkColor (m_color[m_hg3]);
    return m_brush[m_hg3];
    }

    return hbr;
    }


Anmelden zum Antworten