当前位置: 首页>>代码示例>>C++>>正文


C++ CCoolBarItem::Paint方法代码示例

本文整理汇总了C++中CCoolBarItem::Paint方法的典型用法代码示例。如果您正苦于以下问题:C++ CCoolBarItem::Paint方法的具体用法?C++ CCoolBarItem::Paint怎么用?C++ CCoolBarItem::Paint使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CCoolBarItem的用法示例。


在下文中一共展示了CCoolBarItem::Paint方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: DoPaint

void CCoolBarCtrl::DoPaint(CDC* pDC, CRect& rcClient, BOOL bTransparent)
{
	CRect rcItem( rcClient.left + MARGIN_WIDTH, rcClient.top + 1, rcClient.right - MARGIN_WIDTH, rcClient.bottom - 1 );
	CRect rcCopy;
	
	if ( m_bGripper )
	{
		if ( bTransparent )
		{
			for ( int nY = rcClient.top + 4 ; nY < rcClient.bottom - 4 ; nY += 2 )
			{
				pDC->Draw3dRect( rcClient.left + 3, nY, GRIPPER_WIDTH, 1,
					CoolInterface.m_crDisabled, CoolInterface.m_crDisabled );
			}
		}
		else
		{
			for ( int nY = rcClient.top + 4 ; nY < rcClient.bottom - 4 ; nY += 2 )
			{
				pDC->Draw3dRect( rcClient.left + 3, nY, GRIPPER_WIDTH, 2,
					CoolInterface.m_crDisabled, CoolInterface.m_crMidtone );
			}
			
			pDC->ExcludeClipRect( rcClient.left + 3, rcClient.top + 4, rcClient.left + GRIPPER_WIDTH + 2, rcClient.bottom - 4 );
		}
		
		rcItem.left += GRIPPER_WIDTH;
	}
	
	if ( m_pItems.GetCount() == 0 ) return;
	
	CFont* pOldFont = (CFont*)pDC->SelectObject( m_bBold ? &CoolInterface.m_fntBold : &CoolInterface.m_fntNormal );
	BOOL bRight = FALSE;
	
	for ( POSITION pos = m_pItems.GetHeadPosition() ; pos ; )
	{
		CCoolBarItem* pItem = (CCoolBarItem*)m_pItems.GetNext( pos );
		
		if ( pItem->m_nID == ID_RIGHTALIGN && ! bRight )
		{
			int nRight = 0;
			bRight = TRUE;
			
			for ( POSITION pos2 = pos ; pos2 ; )
			{
				CCoolBarItem* pRight = (CCoolBarItem*)m_pItems.GetNext( pos2 );
				if ( pRight->m_bVisible ) nRight += pRight->m_nWidth;
			}
			
			if ( rcClient.right - rcItem.left >= nRight + MARGIN_WIDTH )
			{
				rcItem.left = rcClient.right - nRight - MARGIN_WIDTH;
			}
		}
		else if ( pItem->m_bVisible )
		{
			
			rcItem.right = rcItem.left + pItem->m_nWidth;
			rcCopy.CopyRect( &rcItem );
			
			CWnd* pCtrl = ( pItem->m_nCtrlID ) ? GetDlgItem( pItem->m_nCtrlID ) : NULL;
			
			pItem->Paint( pDC, rcCopy, m_pDown == pItem,
				m_pHot == pItem || ( pCtrl && pCtrl == GetFocus() ),
				m_bMenuGray, bTransparent );
			
			if ( ! bTransparent ) pDC->ExcludeClipRect( &rcItem );
			if ( pCtrl ) SmartMove( pCtrl, &rcCopy );
			
			rcItem.OffsetRect( rcItem.Width(), 0 );
		}
		else if ( pItem->m_nCtrlID )
		{
			CWnd* pCtrl = GetDlgItem( pItem->m_nCtrlID );
			if ( pCtrl && pCtrl->IsWindowVisible() ) pCtrl->ShowWindow( SW_HIDE );
		}
	}
	
	pDC->SelectObject( pOldFont );
}
开发者ID:pics860,项目名称:callcenter,代码行数:80,代码来源:ctrlcoolbar.cpp


注:本文中的CCoolBarItem::Paint方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。