本文整理汇总了C++中Box2d::inflate方法的典型用法代码示例。如果您正苦于以下问题:C++ Box2d::inflate方法的具体用法?C++ Box2d::inflate怎么用?C++ Box2d::inflate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Box2d
的用法示例。
在下文中一共展示了Box2d::inflate方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnZoomed
void CScrollShapeView::OnZoomed()
{
CRandomShapeView::OnZoomed();
Box2d rect;
// m_rcLimits: 极限范围对应的坐标范围, 像素
rect = m_shapes->getExtent() * m_graph->xf.modelToDisplay();
rect.inflate(1, 1);
rect.get(m_rcLimits);
// m_rcScrWnd: 当前窗口对应的坐标范围, 像素
rect = Box2d(m_graph->xf.getCenterW(),
m_graph->xf.getWidth() / m_graph->xf.getWorldToDisplayX(),
m_graph->xf.getHeight() / m_graph->xf.getWorldToDisplayY());
rect *= m_graph->xf.worldToDisplay();
rect.get(m_rcScrWnd);
// 以m_rcLimits左上角为原点调整m_rcScrWnd和m_rcLimits
::OffsetRect(&m_rcScrWnd, -m_rcLimits.left, -m_rcLimits.top);
::OffsetRect(&m_rcLimits, -m_rcLimits.left, -m_rcLimits.top);
// 避免m_rcScrWnd部分超出m_rcLimits
::UnionRect(&m_rcLimits, &m_rcLimits, &m_rcScrWnd);
SCROLLINFO si;
si.cbSize = sizeof(si);
si.fMask = SIF_RANGE | SIF_PAGE | SIF_POS;
si.nMin = 0;
if (m_rcLimits.right - m_rcLimits.left > m_rcScrWnd.right - m_rcScrWnd.left)
{
si.nMax = max(1, m_rcLimits.right - m_rcLimits.left);
si.nPage = m_rcScrWnd.right - m_rcScrWnd.left;
si.nPos = m_rcScrWnd.left;
::EnableScrollBar(m_hWnd, SB_HORZ, ESB_ENABLE_BOTH);
::SetScrollInfo(m_hWnd, SB_HORZ, &si, TRUE);
}
else
{
::EnableScrollBar(m_hWnd, SB_HORZ, ESB_DISABLE_BOTH);
}
if (m_rcLimits.bottom - m_rcLimits.top > m_rcScrWnd.bottom - m_rcScrWnd.top)
{
si.nMax = max(1, m_rcLimits.bottom - m_rcLimits.top);
si.nPage = m_rcScrWnd.bottom - m_rcScrWnd.top;
si.nPos = m_rcScrWnd.top;
::EnableScrollBar(m_hWnd, SB_VERT, ESB_ENABLE_BOTH);
::SetScrollInfo(m_hWnd, SB_VERT, &si, TRUE);
}
else
{
::EnableScrollBar(m_hWnd, SB_VERT, ESB_DISABLE_BOTH);
}
}