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


C# Rectangle2D.Add方法代码示例

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


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

示例1: OnMouseMove

        /// <summary>
        /// Overridable that is called when the mouse cursor moves in the view
        /// </summary>
        /// <param name="e">Mouse event arguments directly passed through</param>
        /// <param name="eKeyMod">Key modifier bitmask (Shift, Alt, ...)</param>
        /// <param name="iOldX">Previous screen x position</param>
        /// <param name="iOldY">Previous screen y position</param>
        /// <returns>return true to redraw the view immediately</returns>
        public override bool OnMouseMove(MouseEventArgs e, KeyModifier eKeyMod, int iOldX, int iOldY)
        {
            if (Dragmode == MOUSE_MODE.UI_AREA_SELECT)
            {
                View.RenderRectangle2D(m_MouseDownPoint.X, m_MouseDownPoint.Y, e.X, e.Y, VisionColors.RGBA(255, 255, 255, 255), 1.0f);
            }
            else if (eKeyMod == KeyModifier.Ctrl )
            {

            }
            else
            {
                if (m_selectedShapeList.Count > 0 )
                {
                    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;

//.........这里部分代码省略.........
开发者ID:taru00,项目名称:GUIEditor,代码行数:101,代码来源:UIEditorMouseContext.cs


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