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


C++ CChildFrame::GetSnapSize方法代码示例

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


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

示例1: OnMouseMove

void CNuGenDimensionView::OnMouseMove(UINT nFlags, CPoint point)
{
    CChildFrame* pFrame = static_cast<CChildFrame*>(GetParentFrame());
    SetFocus();
    if (!pFrame->m_commander)
    {
        switch (m_hand_action )
        {
        case HA_ROTATE:
            if (nFlags & MK_LBUTTON)
            {
                SG_VECTOR downPnt;
                SG_VECTOR curPnt;
                // Convert the mouse left button down position to world
                m_Camera.GetWorldCoord(m_ScreenLeftButtonDownPoint.x,
                                       m_ScreenLeftButtonDownPoint.y,
                                       0.0,
                                       downPnt);
                // Convert the mouse point into world coordinates
                m_Camera.GetWorldCoord(point.x,	point.y, 0.0,curPnt);
                //VecSubf(curPnt, downPnt, curPnt);
                curPnt = sgSpaceMath::VectorsSub(curPnt, downPnt);
                CSize deltaPos;
                deltaPos = m_ScreenLeftButtonDownPoint - point;
                m_ScreenLeftButtonDownPoint = point;
                RotateCamera(deltaPos);
                Invalidate(FALSE);
            }
            break;
        case HA_MOVE:
            if (nFlags & MK_LBUTTON)
            {
                SG_VECTOR downPnt;
                SG_VECTOR curPnt;
                // Convert the mouse left button down position to world
                m_Camera.GetWorldCoord(m_ScreenLeftButtonDownPoint.x,
                                       m_ScreenLeftButtonDownPoint.y,
                                       0.0,
                                       downPnt);
                // Convert the mouse point into world coordinates
                m_Camera.GetWorldCoord(point.x,	point.y, 0.0,curPnt);
                //VecSubf(curPnt, downPnt, curPnt);
                curPnt = sgSpaceMath::VectorsSub(curPnt, downPnt);
                m_ScreenLeftButtonDownPoint = point;
                TranslateCamera(curPnt);
                Invalidate(FALSE);
            }
            break;
        case HA_ZOOM:
            if (nFlags & MK_LBUTTON)
            {
                SG_VECTOR downPnt;
                SG_VECTOR curPnt;
                // Convert the mouse left button down position to world
                m_Camera.GetWorldCoord(m_ScreenLeftButtonDownPoint.x,
                                       m_ScreenLeftButtonDownPoint.y,
                                       0.0,
                                       downPnt);
                // Convert the mouse point into world coordinates
                m_Camera.GetWorldCoord(point.x,	point.y, 0.0,curPnt);
                //VecSubf(curPnt, downPnt, curPnt);
                curPnt = sgSpaceMath::VectorsSub(curPnt, downPnt);
                CSize deltaPos;
                deltaPos = m_ScreenLeftButtonDownPoint - point;
                m_ScreenLeftButtonDownPoint = point;
                ZoomCamera(deltaPos);
                Invalidate(FALSE);
            }
            break;
        default:
            break;
        }
    }

    if (!pFrame->m_commander)
        /*pFrame->m_commander->MouseMove(nFlags,point.x,point.y);
        else*/
        if (!(nFlags & MK_LBUTTON))
        {
            int snapSz = pFrame->GetSnapSize();
            const sgCObject* oldHotObj = Drawer::CurrentHotObject;

            Drawer::CurrentHotObject = GetTopObject(GetHitsInRect(CRect(point.x-snapSz, point.y-snapSz,
                                                    point.x+snapSz, point.y+snapSz),true));
            Drawer::TopParentOfHotObject = GetObjectTopParent(Drawer::CurrentHotObject);
            if (Drawer::TopParentOfHotObject)
                Drawer::CurrentHotObject = Drawer::TopParentOfHotObject;
            /**************************************/
            if (Drawer::CurrentHotObject &&
                    (Drawer::CurrentHotObject->GetType()==SG_OT_LINE ||
                     Drawer::CurrentHotObject->GetType()==SG_OT_CIRCLE ||
                     Drawer::CurrentHotObject->GetType()==SG_OT_SPLINE ||
                     Drawer::CurrentHotObject->GetType()==SG_OT_ARC ||
                     Drawer::CurrentHotObject->GetType()==SG_OT_CONTOUR)
               )
            {
                sgC2DObject* spl = reinterpret_cast<sgC2DObject*>(Drawer::CurrentHotObject);
                CString messs = "2DObject ";
                if (spl->IsClosed())
                    messs += " Closed; ";
//.........这里部分代码省略.........
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:101,代码来源:NuGenDimensionView.cpp


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