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


C# Rectangle2D.IsInside方法代码示例

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


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

示例1: AddShapesRecursive

        void AddShapesRecursive(ShapeCollection target, ShapeBase parent, Rectangle2D selection )
        {
            if (parent.ShapeVirtualCounter==0 && parent.CanCopyPaste && (parent is Shape3D))
              {
            Shape3D shape3D = (Shape3D)parent;
            if (selection.IsInside(shape3D.x, shape3D.y))
            {
              target.Add(parent);
              //return; // iterate through children as well - the CloneForClipboard will take care of handling duplicates
            }
              }

              if (parent.HasChildren())
              {
            ShapeCollection children = parent.ChildCollection;
            foreach (ShapeBase child in children)
              AddShapesRecursive(target, child, selection);
              }
        }
开发者ID:romance-ii,项目名称:projectanarchy,代码行数:19,代码来源:TerrainShape.cs

示例2: OnMouseMove


//.........这里部分代码省略.........
                    if (Dragmode == MOUSE_MODE.UI_MOVE || Dragmode == MOUSE_MODE.UI_COPY )
                    {
                        // this.MoveUIShape(m_selectedShape, e.X, e.Y);
                        foreach (UIShapeBase shape in m_selectedShapeList)
                        {
                            this.MoveUIShapeDelta(shape, e.X - iOldX, e.Y - iOldY);
                        }
                    }
                    else if (Dragmode == MOUSE_MODE.UI_SIZE)
                    {
                        foreach (UIShapeBase shape in m_selectedShapeList)
                        {
                            Rectangle2D newRect = new Rectangle2D();

                            float fDeltaX = (e.X - iOldX);
                            float fDeltaY = (e.Y - iOldY);

                            if (View.Cursor == Cursors.PanNW)
                            {
                                newRect.Add(shape.ScreenBound.X2, shape.ScreenBound.Y2);
                                newRect.Add(shape.ScreenBound.X1 + fDeltaX, shape.ScreenBound.Y1 + fDeltaY);

                                newRect.Validate();
                                shape.ScreenBound = newRect;
                            }
                            else if (View.Cursor == Cursors.PanSW)
                            {
                                newRect.Add(shape.ScreenBound.X2, shape.ScreenBound.Y1);
                                newRect.Add(shape.ScreenBound.X1 + fDeltaX, shape.ScreenBound.Y2 + fDeltaY);

                                newRect.Validate();
                                shape.ScreenBound = newRect;
                            }
                            else if (View.Cursor == Cursors.PanNE)
                            {
                                newRect.Add(shape.ScreenBound.X1, shape.ScreenBound.Y2);
                                newRect.Add(shape.ScreenBound.X2 + fDeltaX, shape.ScreenBound.Y1 + fDeltaY);

                                newRect.Validate();
                                shape.ScreenBound = newRect;
                            }
                            else if (View.Cursor == Cursors.PanSE)
                            {
                                newRect.Add(shape.ScreenBound.X1, shape.ScreenBound.Y1);
                                newRect.Add(shape.ScreenBound.X2 + fDeltaX, shape.ScreenBound.Y2 + fDeltaY);

                                newRect.Validate();
                                shape.ScreenBound = newRect;
                            }
                        }
                    }
                }
                else
                {

                }

                if (Dragmode == MOUSE_MODE.UI_NONE)
                {
                    UIShapeBase tempShape = this.GetUIShapeFromSelection(e.X, e.Y);

                    if (tempShape == null)
                    {
                        View.Cursor = Cursors.Default;
                    }
                    else
                    {
                        int margin = 15;
                        Rectangle2D mouseBound = new Rectangle2D();

                        mouseBound.Add(e.X - margin, e.Y - margin);
                        mouseBound.Add(e.X + margin, e.Y + margin);

                        float fX1 = tempShape.ScreenBound.X1;
                        float fY1 = tempShape.ScreenBound.Y1;
                        float fX2 = tempShape.ScreenBound.X2;
                        float fY2 = tempShape.ScreenBound.Y2;

                        if (mouseBound.IsInside(fX1, fY1))
                            View.Cursor = Cursors.PanNW;
                        else if (mouseBound.IsInside(fX1, fY2))
                            View.Cursor = Cursors.PanSW;
                        else if (mouseBound.IsInside(fX2, fY1))
                            View.Cursor = Cursors.PanNE;
                        else if (mouseBound.IsInside(fX2, fY2))
                            View.Cursor = Cursors.PanSE;
                        else if (tempShape is UIShapeDialog)      // 다이얼로그는 사이즈조정밖에 안됨
                        {
                            View.Cursor = Cursors.Arrow;
                        }
                        else
                        {
                            View.Cursor = Cursors.SizeAll;
                        }
                    }
                }
            }

            return false;
        }
开发者ID:taru00,项目名称:GUIEditor,代码行数:101,代码来源:UIEditorMouseContext.cs


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