示例#1
0
        public static void AddRectangleHandles(GoObject myObject, RectangleF rect, PointF center, float angle, GoSelection sel, GoObject selectedObj)
        {
            GoView view  = sel.View;
            bool   flag  = view?.CanResizeObjects() ?? true;
            bool   flag2 = view?.CanReshapeObjects() ?? true;

            if (myObject.CanResize() && flag)
            {
                float  x      = rect.X;
                float  x2     = rect.X + rect.Width / 2f;
                float  x3     = rect.X + rect.Width;
                float  y      = rect.Y;
                float  y2     = rect.Y + rect.Height / 2f;
                float  y3     = rect.Y + rect.Height;
                double num    = (double)angle * Math.PI / 180.0;
                double cosine = Math.Cos(num);
                double sine   = Math.Sin(num);
                SetResizeCursor(sel.CreateResizeHandle(myObject, selectedObj, RotatePoint(new PointF(x, y), center, cosine, sine), 2, filled: true), angle);
                SetResizeCursor(sel.CreateResizeHandle(myObject, selectedObj, RotatePoint(new PointF(x3, y), center, cosine, sine), 4, filled: true), angle);
                SetResizeCursor(sel.CreateResizeHandle(myObject, selectedObj, RotatePoint(new PointF(x3, y3), center, cosine, sine), 8, filled: true), angle);
                SetResizeCursor(sel.CreateResizeHandle(myObject, selectedObj, RotatePoint(new PointF(x, y3), center, cosine, sine), 16, filled: true), angle);
                if (myObject.CanReshape() && flag2)
                {
                    SetResizeCursor(sel.CreateResizeHandle(myObject, selectedObj, RotatePoint(new PointF(x2, y), center, cosine, sine), 32, filled: true), angle);
                    SetResizeCursor(sel.CreateResizeHandle(myObject, selectedObj, RotatePoint(new PointF(x3, y2), center, cosine, sine), 64, filled: true), angle);
                    SetResizeCursor(sel.CreateResizeHandle(myObject, selectedObj, RotatePoint(new PointF(x2, y3), center, cosine, sine), 128, filled: true), angle);
                    SetResizeCursor(sel.CreateResizeHandle(myObject, selectedObj, RotatePoint(new PointF(x, y2), center, cosine, sine), 256, filled: true), angle);
                }
            }
        }
示例#2
0
        /// <summary>
        /// Return the appropriate resize cursor name for the handle ID's corresponding to
        /// the standard spots, but return null if the object cannot be resized.
        /// </summary>
        /// <param name="view"></param>
        /// <returns>
        /// null if <see cref="M:Northwoods.Go.GoView.CanResizeObjects" /> is false or if
        /// <see cref="P:Northwoods.Go.GoHandle.GoObject" />.<c>CanResize</c> and <see cref="P:Northwoods.Go.GoHandle.GoObject" />.<c>CanReshape</c> are both false;
        /// otherwise the value of <see cref="P:Northwoods.Go.GoHandle.CursorName" /> if it is non-null;
        /// finally a cursor name depending on the <see cref="P:Northwoods.Go.GoHandle.HandleID" />,
        /// such as "se-resize" for <see cref="P:Northwoods.Go.GoHandle.GoObject" />.<c>BottomRight</c> or
        /// "hand" for <see cref="F:Northwoods.Go.GoLink.RelinkableToHandle" />, or "move"
        /// for most other handles, or finally null if the <see cref="P:Northwoods.Go.GoHandle.HandleID" />
        /// is <see cref="P:Northwoods.Go.GoHandle.GoObject" />.<c>NoHandle</c>.
        /// </returns>
        public override string GetCursorName(GoView view)
        {
            GoObject handledObject = HandledObject;

            if (handledObject == null || (view != null && !view.CanResizeObjects()) || (!handledObject.CanResize() && !handledObject.CanReshape()))
            {
                return(null);
            }
            string text = CursorName;

            if (text == null)
            {
                text = GetCursorNameForHandleID(HandleID);
            }
            return(text);
        }