To display the Note property, change the drawing behavior in the OnDraw
function in CIRCCTL.CPP. The Note property is drawn in the upper-left corner of the control's bounding rectangle, using the stock Font and ForeColor properties.
To change the OnDraw function to display the Note property
OnDraw
function in CIRCCTL.CPP: // Draw the caption and note using the stock Font and ForeColor properties
...
pdc->SetTextAlign(TA_LEFT | TA_TOP);
pdc->ExtTextOut(rc.left, rc.top,
ETO_CLIPPED, rc, m_note, m_note.GetLength(), NULL);
as shown in the following example:
void CCircCtrl::OnDraw(
CDC* pdc, const CRect& rcBounds, const CRect& rcInvalid)
{
CBrush* pOldBrush;
CBrush bkBrush(TranslateColor(GetBackColor()));
CPen* pOldPen;
CRect rc = rcBounds;
CFont* pOldFont;
TEXTMETRIC tm;
const CString& strCaption = InternalGetText();
// Set the ForeColor property color and transparent background mode into the device context
pdc->SetTextColor(TranslateColor(GetForeColor()));
pdc->SetBkMode(TRANSPARENT);
// Paint the background using the BackColor property
pdc->FillRect(rcBounds, &bkBrush);
// Draw the ellipse using the BackColor property and a black pen
GetDrawRect(&rc);
pOldBrush = pdc->SelectObject(&bkBrush);
pOldPen = (CPen*)pdc->SelectStockObject(BLACK_PEN);
pdc->Ellipse(rc);
// Draw the caption and note using the stock Font and ForeColor properties
pOldFont = SelectStockFont(pdc);
pdc->GetTextMetrics(&tm);
pdc->SetTextAlign(TA_CENTER | TA_TOP);
pdc->ExtTextOut((rc.left + rc.right) / 2, (rc.top + rc.bottom - tm.tmHeight) / 2,
ETO_CLIPPED, rc, strCaption, strCaption.GetLength(), NULL);
pdc->SetTextAlign(TA_LEFT | TA_TOP);
pdc->ExtTextOut(rc.left, rc.top,
ETO_CLIPPED, rc, m_note, m_note.GetLength(), NULL);
pdc->SelectObject(pOldFont);
pdc->SelectObject(pOldPen);
pdc->SelectObject(pOldBrush);
}