/// <summary> /// The overview rectangle should only appear selected if the <see cref="T:Northwoods.Go.GoOverview" /> /// supports resizing (i.e. <see cref="P:Northwoods.Go.GoView.AllowSelect" /> and <see cref="P:Northwoods.Go.GoView.AllowResize" /> are true), /// and even then the handles will not be seen since their <see cref="T:Northwoods.Go.GoHandle" />.<see cref="T:Northwoods.Go.GoHandleStyle" /> /// is <see cref="F:Northwoods.Go.GoHandleStyle.None" />. /// </summary> /// <param name="sel"></param> /// <param name="selectedObj"></param> public override void AddSelectionHandles(GoSelection sel, GoObject selectedObj) { GoView view = sel.View; if (view != null && view.CanSelectObjects() && view.CanResizeObjects()) { view.ResizeHandleSize = new SizeF(4f / view.DocScale, 4f / view.DocScale); RemoveSelectionHandles(sel); RectangleF bounds = Bounds; GoHandle goHandle = sel.CreateResizeHandle(this, selectedObj, new PointF(bounds.Left, bounds.Top), 2, filled: true) as GoHandle; if (goHandle != null) { goHandle.Style = GoHandleStyle.None; } goHandle = (sel.CreateResizeHandle(this, selectedObj, new PointF(bounds.Right, bounds.Top), 4, filled: true) as GoHandle); if (goHandle != null) { goHandle.Style = GoHandleStyle.None; } goHandle = (sel.CreateResizeHandle(this, selectedObj, new PointF(bounds.Right, bounds.Bottom), 8, filled: true) as GoHandle); if (goHandle != null) { goHandle.Style = GoHandleStyle.None; } goHandle = (sel.CreateResizeHandle(this, selectedObj, new PointF(bounds.Left, bounds.Bottom), 16, filled: true) as GoHandle); if (goHandle != null) { goHandle.Style = GoHandleStyle.None; } } }
private static void SetResizeCursor(IGoHandle handle, float angle) { GoHandle goHandle = handle as GoHandle; if (goHandle != null) { float num = angle; switch (goHandle.HandleID) { default: return; case 64: num += 0f; break; case 8: num += 45f; break; case 128: num += 90f; break; case 16: num += 135f; break; case 256: num += 180f; break; case 2: num += 225f; break; case 32: num += 270f; break; case 4: num += 315f; break; } if (num < 0f) { num += 360f; } else if (num >= 360f) { num -= 360f; } if (num < 22.5f) { goHandle.CursorName = "e-resize"; } else if (num < 67.5f) { goHandle.CursorName = "se-resize"; } else if (num < 112.5f) { goHandle.CursorName = "s-resize"; } else if (num < 157.5f) { goHandle.CursorName = "sw-resize"; } else if (num < 202.5f) { goHandle.CursorName = "w-resize"; } else if (num < 247.5f) { goHandle.CursorName = "nw-resize"; } else if (num < 292.5f) { goHandle.CursorName = "n-resize"; } else if (num < 337.5f) { goHandle.CursorName = "ne-resize"; } else { goHandle.CursorName = "e-resize"; } } }