void CMainFrame::OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStruct)
{
// TODO: Add your message handler code here and/or call default
CDC* pDC = CDC::FromHandle(lpDrawItemStruct->hDC);
static nIndex = 0;
if (nIDCtl == ID_VIEW_STATUS_BAR) {
DrawBitmaps(pDC,nIndex,lpDrawItemStruct->rcItem.left,
lpDrawItemStruct->rcItem.top);
nIndex++;
nIndex %= 10;
}
// 去掉缺省的绘制函数
// CFrameWnd::OnDrawItem(nIDCtl, lpDrawItemStruct);
}
本文介绍了一个C++中关于窗口控件绘制的方法OnDrawItem。该方法通过CDC绘图对象绘制位图到状态栏,并实现位图的循环显示。代码示例展示了如何在特定控件上进行自定义绘制。
1401

被折叠的 条评论
为什么被折叠?



