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


C++ CXTPToolBar::Redraw方法代码示例

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


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

示例1: _AdjustRow


//.........这里部分代码省略.........

	// Step 3. if Total length is more than available, make it expandable.
	if (nLen > nLength)
	{
		int nSum = 0;
		for (nPos = 0; nPos < arrInfo.GetSize(); nPos++)
		{
			CXTPToolBar* pBar = arrInfo[nPos].pBar;

			if (!(_GetMode(bHorz, pBar) & LM_HIDEWRAP))
				arrInfo[nPos].nMinWidth = nLength;
			else
			{
				CSize sz = pBar->CalcDockingLayout(1, _GetMode(bHorz, pBar));
				arrInfo[nPos].nMinWidth = bHorz ? sz.cx : sz.cy;
			}

			arrInfo[nPos].nTotlaMinWidth = nSum;
			nSum += arrInfo[nPos].nMinWidth;
		}

		nLen = nLength;
		for (nPos = (int)arrInfo.GetSize() - 1; nPos >= 0; nPos--)
		{
			CRect& rect = arrInfo[nPos].rcBar;
			int nLeft = bHorz ? arrInfo[nPos].rcMRUPos.left : arrInfo[nPos].rcMRUPos.top;

			if (nLeft > rect.left) nLeft = rect.left;
			if (nLeft < nLen - rect.Width()) nLeft = nLen - rect.Width();

			if (nLeft < arrInfo[nPos].nTotlaMinWidth) nLeft = arrInfo[nPos].nTotlaMinWidth;
			if (nLen - nLeft < arrInfo[nPos].nMinWidth) nLeft = nLen - arrInfo[nPos].nMinWidth;

			if ((nLen - nLeft < arrInfo[nPos].nMinWidth || nLeft < arrInfo[nPos].nTotlaMinWidth)
				&& arrInfo.GetSize() != 1)
			{
				nRemove = arrInfo[arrInfo.GetSize() - 1].nIndex;
				return -1;
			}

			rect.right = nLen;
			nLen = rect.left = max(0, nLeft);
		}
	}

	if (!bHorz) arrInfo.InvertRects();


	int nWidth = 0;
	// Calculate total width
	for (nPos = 0; nPos < arrInfo.GetSize(); nPos++)
	{
		CXTPToolBar* pBar = arrInfo[nPos].pBar;
		CRect& rect = arrInfo[nPos].rcBar;
		CSize sizeBar = pBar->CalcDockingLayout(bHorz ? rect.Width() : rect.Height(), _GetMode(bHorz, pBar));
		nWidth = max(nWidth, bHorz ? sizeBar.cy : sizeBar.cx);
	}

	if (lpLayout->hDWP == 0)
		return nWidth;

	// Step 4. Move it.
	for (nPos = 0; nPos < arrInfo.GetSize(); nPos++)
	{
		CXTPToolBar* pBar = arrInfo[nPos].pBar;
		CRect& rect = arrInfo[nPos].rcBar;
		int nMode = _GetMode(bHorz, pBar) | LM_COMMIT;

		if (pBar->GetFlags() & xtpFlagStretchedShared)
		{
			if (bHorz)
			{
				rect.right = nPos == arrInfo.GetSize() - 1 ? nLength : arrInfo[nPos + 1].rcBar.left;
				rect.left = nPos == 0 ? 0 : min(arrInfo[nPos - 1].rcBar.right, rect.left);
			}
			else
			{
				rect.bottom = nPos == arrInfo.GetSize() - 1 ? nLength : arrInfo[nPos + 1].rcBar.top;
				rect.top = nPos == 0 ? 0 : min(arrInfo[nPos - 1].rcBar.bottom, rect.top);
			}

			nMode |= LM_STRETCH;
		}

		CSize sz = pBar->CalcDockingLayout(bHorz ? rect.Width() : rect.Height(), nMode, nWidth);
		rect = CRect(rect.TopLeft(), sz);

		pBar->m_pDockContext->m_uMRUDockPosition = GetPosition();

		CXTPWindowRect rectOld(pBar);
		ScreenToClient(&rectOld);

		if (!::EqualRect(rectOld, rect))
		{
			AfxRepositionWindow(lpLayout, pBar->m_hWnd, &rect);
			pBar->Redraw();
		}
	}
	return nWidth;
}
开发者ID:killbug2004,项目名称:ghost2013,代码行数:101,代码来源:XTPDockBar.cpp


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