Advertisement
Advertisement
There are currently no qualifying experts in Windows OLE
| 09.17.2008 at 12:49PM PDT, ID: 23740128 | Points: 500 |
|
[x]
Attachment Details
|
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: |
void CMyButton::OnPaint()
{
CPaintDC dc(this); // device context for painting
// Get client rect.
CRect rc;
GetClientRect(rc);
DrawButton(&dc, rc, some_app_data, GetState());
// Do not call CButton::OnPaint() for painting messages
}
void CMyButton::OnDraw(CDC* pdc, const CRect& rcBounds, const CRect& rcInvalid)
{
DoSuperclassPaint(pdc, rcBounds);
if (AmbientUserMode())
{
// Control is in run-mode.
// If control window has not been created, then create it.
if (!IsWindow(m_NButton.m_hWnd))
{
CRect rc;
GetClientRect(rc);
// A class 'CMyButton' is derived from the standard Microsoft
// CButton class. The CMyButton class is the control when in
// run-mode.
m_MyButton.Create(_T("MyButton"),
WS_CHILD | WS_VISIBLE | BS_OWNERDRAW | GetStyle(),
rc, this, 0);
m_MyButton.EnableWindow(m_buttonData.bEnabled);
}
// The button will be drawn in the CMyButton object.
}
else
{
// Control is in design-mode.
DrawButton(pdc, rcBounds, m_buttonData, 0x00);
}
}
|