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


C++ CDCHandle::IntersectClipRect方法代码示例

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


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

示例1: DoPaint

void CTuotuoTabCtrl::DoPaint(CDCHandle dc, const RECT &rcClip) const
{
	RECT rcClient;
	GetClientRect(&rcClient);

	dc.SetBkMode(TRANSPARENT);
	s()->Toolbar()->DrawRebarBackPart(dc, rcClient, m_hWnd);

	int iOffSetTop = rcClient.bottom - s()->Tab()->GetTabHeight();
	if (iOffSetTop < 0)
		iOffSetTop = 0;
	rcClient.top += iOffSetTop;

	// draw scroll button
	if (m_bOverflowLeft || m_bOverflowRight || (m_bClosingTabs && m_iLastLayout == 2))
	{
		if (m_bOverflowLeft)
		{
			s()->Tab()->DrawTabScrollButton(dc, m_rcScrollLLeft, m_ePosition == POS_ScrollLLeftBtn ? m_eButtonStatus : Btn_MouseOut, 0);
		}
		else
		{
			s()->Tab()->DrawTabScrollButton(dc, m_rcScrollLLeft, Btn_Disabled, 0);
		}

		if (m_bOverflowRight)
			s()->Tab()->DrawTabScrollButton(dc, m_rcScrollRRight, m_ePosition == POS_ScrollRRightBtn ? m_eButtonStatus : Btn_MouseOut, 1);
		else
			s()->Tab()->DrawTabScrollButton(dc, m_rcScrollRRight, Btn_Disabled, 1);
	}

	// draw sidebar button
	// draw "new tab" button
	//s()->Tab()->DrawNewTabButton(dc, m_rcNewTabBtn, m_ePosition == POS_NewTabBtn ? m_eButtonStatus : Btn_MouseOut);

	// draw tabs
	if (GetItemCountInDraggingMode() == 0)
		return;

	dc.IntersectClipRect(&m_rcTabItemAreaDraw);
	dc.SetViewportOrg(m_iScrollOffsetAni + m_rcTabItemArea.left, 0);

	// we draw the selected item at the last
	dc.SelectFont(s()->Common()->GetDefaultFont());
	ButtonStatus eTabCloseBtnStatus = m_ePosition == POS_TabItemClose ? m_eButtonStatus : Btn_MouseOut;
	int iRightBorder = m_rcTabItemArea.right - m_rcTabItemArea.left - m_iScrollOffsetAni;
	size_t nScrollLeft = - m_iScrollOffsetAni / m_iCurrentWidth;
	size_t nScrollRight = iRightBorder / m_iCurrentWidth + (iRightBorder % m_iCurrentWidth == 0 ? 0 : 1);
	size_t nPaintRight = min(nScrollRight, m_TabItems.size() - 1);

	if (m_nDragToPos == -2)
	{
		for (size_t i = nScrollLeft == 0 ? 0 : nScrollLeft - 1; i <= nPaintRight; i++)
			if (m_TabItems[i] != m_pSelectedItem)
				m_TabItems[i]->DoPaint(dc, m_TabItems[i] == m_pHotItem ? Btn_MouseOver : Btn_MouseOut, m_TabItems[i] == m_pHotItem ? m_ePosition : POS_TabItem, m_eButtonStatus, m_eTabCloseButton == CloseBtn_AlwaysDisplay, iOffSetTop, false);
		dc.SelectFont(s()->Common()->GetBoldFont());
		if (m_pSelectedItem && TAB_MATCH_INTERVAL(nScrollLeft, m_pSelectedItem->GetIndex(), nScrollRight))
			m_pSelectedItem->DoPaint(dc, Btn_MouseDown, m_pSelectedItem == m_pHotItem ? m_ePosition : POS_TabItem, m_eButtonStatus, m_eTabCloseButton != CloseBtn_AlwaysHide, iOffSetTop, false);

		dc.SelectClipRgn(NULL);
		dc.SetViewportOrg(0, 0);
	}
	else		// 拖动状态
	{
		if (m_bDraggingSource)			// 正常状态显示 || 在自己的框架里面拖动
		{
			for (size_t i = nScrollLeft; i <= nPaintRight; i++)
				if (m_TabItems[i] != m_pSelectedItem)
					m_TabItems[i]->DoPaint(dc, Btn_MouseOut, POS_TabItem, Btn_MouseOut, m_eTabCloseButton != CloseBtn_AlwaysHide, iOffSetTop, false);

			dc.SelectClipRgn(NULL);
			dc.SetViewportOrg(0, 0);
			dc.SelectFont(s()->Common()->GetBoldFont());

			if (m_pDraggingItem)
				m_pSelectedItem->DoPaint(dc, Btn_MouseDown, POS_TabItem, Btn_MouseOut, m_eTabCloseButton != CloseBtn_AlwaysHide, iOffSetTop, false);
		}
		else												// 拖到别人的框架里面了
		{
			for (size_t i = nScrollLeft; i <= nPaintRight; i++)
				m_TabItems[i]->DoPaint(dc, Btn_MouseOut, POS_TabItem, Btn_MouseOut, m_eTabCloseButton == CloseBtn_AlwaysDisplay, iOffSetTop, false);

			dc.SelectClipRgn(NULL);
			dc.SetViewportOrg(0, 0);
			dc.SelectFont(s()->Common()->GetBoldFont());

			if (m_pDraggingItem)
				m_pDraggingItem->DoPaint(dc, Btn_MouseDown, POS_TabItem, Btn_MouseOut, m_eTabCloseButton != CloseBtn_AlwaysHide, iOffSetTop, false);
		}
	}
}
开发者ID:Williamzuckerberg,项目名称:chtmoneyhub,代码行数:91,代码来源:TabCtrl.cpp


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