MFC Cedit - Malen des Hintergrunds in einem Teil der Länge malenC++

Programme in C++. Entwicklerforum
Anonymous
 MFC Cedit - Malen des Hintergrunds in einem Teil der Länge malen

Post by Anonymous »

Ich möchte eine Cedit-Steuerung, eine halbe Länge im Hintergrund oder in einem anderen Teil seiner Länge haben. HBRUSH CMyView::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr = CFormView::OnCtlColor(pDC, pWnd, nCtlColor);

if (nCtlColor == CTLCOLOR_EDIT)
{

if (pWnd->GetDlgCtrlID() == IDC_MY_NORMAL_PERCENT_BOX)
{
// Set the text color to red
pDC->SetTextColor(RGB(255, 0, 0));

CRect rc;
// Get the client area of the edit control
m_CTV_Normal_Percent_Box_Ctrl.GetClientRect(&rc);
m_CTV_Normal_Percent_Box_Ctrl.ScreenToClient(&rc);
// Apply the device context to the client area of the edit control
pDC->Rectangle(0, 0, rc.Width()/2, rc.Height());

// Set the background mode for text to transparent
// so background will show thru.
pDC->SetBkMode(TRANSPARENT);

// Return handle to our CBrush object
hbr = m_brush;

}
}

return hbr;
}
< /code>
, aber dies konnte nicht erreicht werden. Könnte jemand möglicherweise helfen? src = "https://i.static.net/ki2jf.png"/>
Danke im Voraus.

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post