/// <summary> /// Create and determine the appearance of a small handle for an object. /// </summary> /// <param name="obj"></param> /// <param name="selectedObj"></param> /// <param name="loc"></param> /// <param name="handleid"></param> /// <param name="filled"></param> /// <returns></returns> /// <remarks> /// This method uses <see cref="M:Northwoods.Go.GoObject.CreateResizeHandle(System.Int32)" /> to /// actually allocate the handle. /// The size of the handle, if not already non-zero, is determined by /// <see cref="P:Northwoods.Go.GoView.ResizeHandleSize" />. /// The pen and brush of the handle are determined by /// <see cref="P:Northwoods.Go.GoView.PrimarySelectionColor" /> and <see cref="P:Northwoods.Go.GoView.SecondarySelectionColor" />. /// The new handle is associated with the <paramref name="obj" /> and its /// <see cref="P:Northwoods.Go.IGoHandle.SelectedObject" /> property is set to <paramref name="selectedObj" />. /// </remarks> /// <seealso cref="M:Northwoods.Go.GoSelection.CreateBoundingHandle(Northwoods.Go.GoObject,Northwoods.Go.GoObject)" /> public virtual IGoHandle CreateResizeHandle(GoObject obj, GoObject selectedObj, PointF loc, int handleid, bool filled) { IGoHandle goHandle = obj.CreateResizeHandle(handleid); if (goHandle == null) { return(null); } goHandle.HandleID = handleid; goHandle.SelectedObject = selectedObj; GoObject goObject = goHandle.GoObject; if (goObject == null) { return(null); } GoView view = View; SizeF sizeF = goObject.Size; if (sizeF.Width <= 0f || sizeF.Height <= 0f) { sizeF = (view?.ResizeHandleSize ?? new SizeF(6f, 6f)); } if (view != null) { sizeF.Width /= view.WorldScale.Width; sizeF.Height /= view.WorldScale.Height; } goObject.Bounds = new RectangleF(loc.X - sizeF.Width / 2f, loc.Y - sizeF.Height / 2f, sizeF.Width, sizeF.Height); if (handleid == 0) { goObject.Selectable = false; } else { goObject.Selectable = true; } GoShape goShape = goObject as GoShape; if (goShape != null) { Color color = Color.LightGray; if (view != null) { color = ((!Focused) ? view.NoFocusSelectionColor : ((Primary == null || Primary.SelectionObject != obj) ? view.SecondarySelectionColor : view.PrimarySelectionColor)); } if (filled) { float resizeHandlePenWidth = view.ResizeHandlePenWidth; float num = (resizeHandlePenWidth == 0f) ? 0f : (resizeHandlePenWidth / view.WorldScale.Width); if (myResizeHandlePen == null || GoShape.GetPenColor(myResizeHandlePen, myResizeHandlePenColor) != myResizeHandlePenColor || GoShape.GetPenWidth(myResizeHandlePen) != num) { myResizeHandlePen = GoShape.NewPen(myResizeHandlePenColor, num); } goShape.Pen = myResizeHandlePen; if (myResizeHandleBrush == null || myResizeHandleBrush.Color != color) { myResizeHandleBrush = new SolidBrush(color); } goShape.Brush = myResizeHandleBrush; } else { float resizeHandlePenWidth2 = view.ResizeHandlePenWidth; float num2 = (resizeHandlePenWidth2 == 0f) ? 0f : ((resizeHandlePenWidth2 + 1f) / view.WorldScale.Width); if (myResizeHandlePen == null || GoShape.GetPenColor(myResizeHandlePen, color) != color || GoShape.GetPenWidth(myResizeHandlePen) != num2) { myResizeHandlePen = GoShape.NewPen(color, num2); } goShape.Pen = myResizeHandlePen; goShape.Brush = null; } } AddHandle(obj, goHandle); return(goHandle); }