private void InitializeGlyph(Rectangle controlBounds, SelectionBorderGlyphType type) { base.hitTestCursor = Cursors.Default; base.rules = SelectionRules.None; base.bounds = DesignerUtils.GetBoundsForSelectionType(controlBounds, type); base.hitBounds = base.bounds; }
/// <summary> /// Used by the Glyphs and ComponentTray to determine the Top, Left, Right, Bottom and Body bound rects related to their original bounds and bordersize. /// </summary> public static Rectangle GetBoundsForSelectionType(Rectangle originalBounds, SelectionBorderGlyphType type, int borderSize) { Rectangle bounds = Rectangle.Empty; switch (type) { case SelectionBorderGlyphType.Top: bounds = new Rectangle(originalBounds.Left - borderSize, originalBounds.Top - borderSize, originalBounds.Width + 2 * borderSize, borderSize); break; case SelectionBorderGlyphType.Bottom: bounds = new Rectangle(originalBounds.Left - borderSize, originalBounds.Bottom, originalBounds.Width + 2 * borderSize, borderSize); break; case SelectionBorderGlyphType.Left: bounds = new Rectangle(originalBounds.Left - borderSize, originalBounds.Top - borderSize, borderSize, originalBounds.Height + 2 * borderSize); break; case SelectionBorderGlyphType.Right: bounds = new Rectangle(originalBounds.Right, originalBounds.Top - borderSize, borderSize, originalBounds.Height + 2 * borderSize); break; case SelectionBorderGlyphType.Body: bounds = originalBounds; break; } return(bounds); }
/// <summary> /// Used by the Glyphs and ComponentTray to determine the Top, Left, Right, Bottom and Body bound rects related to their original bounds and bordersize. /// Offset - how many pixels between the border glyph and the control /// </summary> private static Rectangle GetBoundsForSelectionType(Rectangle originalBounds, SelectionBorderGlyphType type, int bordersize, int offset) { Rectangle bounds = GetBoundsForSelectionType(originalBounds, type, bordersize); if (offset != 0) { switch (type) { case SelectionBorderGlyphType.Top: bounds.Offset(-offset, -offset); bounds.Width += 2 * offset; break; case SelectionBorderGlyphType.Bottom: bounds.Offset(-offset, offset); bounds.Width += 2 * offset; break; case SelectionBorderGlyphType.Left: bounds.Offset(-offset, -offset); bounds.Height += 2 * offset; break; case SelectionBorderGlyphType.Right: bounds.Offset(offset, -offset); bounds.Height += 2 * offset; break; case SelectionBorderGlyphType.Body: bounds = originalBounds; break; } } return(bounds); }
private static Rectangle GetBoundsForSelectionType(Rectangle originalBounds, SelectionBorderGlyphType type, int bordersize, int offset) { Rectangle rectangle = GetBoundsForSelectionType(originalBounds, type, bordersize); if (offset != 0) { switch (type) { case SelectionBorderGlyphType.Top: rectangle.Offset(-offset, -offset); rectangle.Width += 2 * offset; return(rectangle); case SelectionBorderGlyphType.Bottom: rectangle.Offset(-offset, offset); rectangle.Width += 2 * offset; return(rectangle); case SelectionBorderGlyphType.Left: rectangle.Offset(-offset, -offset); rectangle.Height += 2 * offset; return(rectangle); case SelectionBorderGlyphType.Right: rectangle.Offset(offset, -offset); rectangle.Height += 2 * offset; return(rectangle); case SelectionBorderGlyphType.Body: return(originalBounds); } } return(rectangle); }
private void InitializeGlyph(Rectangle controlBounds, SelectionRules selRules, SelectionBorderGlyphType type) { base.rules = SelectionRules.None; base.hitTestCursor = Cursors.Default; if ((selRules & SelectionRules.Moveable) != SelectionRules.None) { base.rules = SelectionRules.Moveable; base.hitTestCursor = Cursors.SizeAll; } base.bounds = DesignerUtils.GetBoundsForNoResizeSelectionType(controlBounds, type); base.hitBounds = base.bounds; switch (type) { case SelectionBorderGlyphType.Top: case SelectionBorderGlyphType.Bottom: this.hitBounds.Y -= (DesignerUtils.SELECTIONBORDERHITAREA - DesignerUtils.SELECTIONBORDERSIZE) / 2; this.hitBounds.Height += DesignerUtils.SELECTIONBORDERHITAREA - DesignerUtils.SELECTIONBORDERSIZE; return; case SelectionBorderGlyphType.Left: case SelectionBorderGlyphType.Right: this.hitBounds.X -= (DesignerUtils.SELECTIONBORDERHITAREA - DesignerUtils.SELECTIONBORDERSIZE) / 2; this.hitBounds.Width += DesignerUtils.SELECTIONBORDERHITAREA - DesignerUtils.SELECTIONBORDERSIZE; return; } }
/// <summary> /// Helper function that initializes the Glyph based on bounds, type, primary sel, and bordersize. /// </summary> private void InitializeGlyph(Rectangle controlBounds, SelectionBorderGlyphType type) { hitTestCursor = Cursors.Default; // always default cursor for locked rules = SelectionRules.None; // never change sel rules for locked // this will return the rect representing the bounds of the glyph bounds = DesignerUtils.GetBoundsForSelectionType(controlBounds, type); hitBounds = bounds; }
private void InitializeGlyph(Rectangle controlBounds, SelectionBorderGlyphType type, bool primarySelection) { base.hitTestCursor = Cursors.Default; base.rules = SelectionRules.None; int borderSize = 1; this.type = type; base.bounds = DesignerUtils.GetBoundsForSelectionType(controlBounds, type, borderSize); base.hitBounds = base.bounds; }
public static Rectangle GetBoundsForSelectionType(Rectangle originalBounds, SelectionBorderGlyphType type, int borderSize) { Rectangle empty = Rectangle.Empty; switch (type) { case SelectionBorderGlyphType.Top: return(new Rectangle(originalBounds.Left - borderSize, originalBounds.Top - borderSize, originalBounds.Width + (2 * borderSize), borderSize)); case SelectionBorderGlyphType.Bottom: return(new Rectangle(originalBounds.Left - borderSize, originalBounds.Bottom, originalBounds.Width + (2 * borderSize), borderSize)); case SelectionBorderGlyphType.Left: return(new Rectangle(originalBounds.Left - borderSize, originalBounds.Top - borderSize, borderSize, originalBounds.Height + (2 * borderSize))); case SelectionBorderGlyphType.Right: return(new Rectangle(originalBounds.Right, originalBounds.Top - borderSize, borderSize, originalBounds.Height + (2 * borderSize))); case SelectionBorderGlyphType.Body: return(originalBounds); } return(empty); }
internal MiniLockedBorderGlyph(Rectangle controlBounds, SelectionBorderGlyphType type, System.Windows.Forms.Design.Behavior.Behavior behavior, bool primarySelection) : base(behavior) { this.InitializeGlyph(controlBounds, type, primarySelection); }
/// <summary> /// This constructor extends from the standard SelectionGlyphBase constructor. Note that a primarySelection flag is passed in - this will be used when determining the colors of the borders. /// </summary> internal LockedBorderGlyph(Rectangle controlBounds, SelectionBorderGlyphType type) : base(null) { InitializeGlyph(controlBounds, type); }
internal NoResizeSelectionBorderGlyph(Rectangle controlBounds, SelectionRules rules, SelectionBorderGlyphType type, System.Windows.Forms.Design.Behavior.Behavior behavior) : base(behavior) { this.InitializeGlyph(controlBounds, rules, type); }
public static Rectangle GetBoundsForSelectionType(Rectangle originalBounds, SelectionBorderGlyphType type, int borderSize) { Rectangle empty = Rectangle.Empty; switch (type) { case SelectionBorderGlyphType.Top: return new Rectangle(originalBounds.Left - borderSize, originalBounds.Top - borderSize, originalBounds.Width + (2 * borderSize), borderSize); case SelectionBorderGlyphType.Bottom: return new Rectangle(originalBounds.Left - borderSize, originalBounds.Bottom, originalBounds.Width + (2 * borderSize), borderSize); case SelectionBorderGlyphType.Left: return new Rectangle(originalBounds.Left - borderSize, originalBounds.Top - borderSize, borderSize, originalBounds.Height + (2 * borderSize)); case SelectionBorderGlyphType.Right: return new Rectangle(originalBounds.Right, originalBounds.Top - borderSize, borderSize, originalBounds.Height + (2 * borderSize)); case SelectionBorderGlyphType.Body: return originalBounds; } return empty; }
public static Rectangle GetBoundsForNoResizeSelectionType(Rectangle originalBounds, SelectionBorderGlyphType type) { return(GetBoundsForSelectionType(originalBounds, type, DesignerUtils.SELECTIONBORDERSIZE, NORESIZEBORDEROFFSET)); }
private static Rectangle GetBoundsForSelectionType(Rectangle originalBounds, SelectionBorderGlyphType type, int bordersize, int offset) { Rectangle rectangle = GetBoundsForSelectionType(originalBounds, type, bordersize); if (offset != 0) { switch (type) { case SelectionBorderGlyphType.Top: rectangle.Offset(-offset, -offset); rectangle.Width += 2 * offset; return rectangle; case SelectionBorderGlyphType.Bottom: rectangle.Offset(-offset, offset); rectangle.Width += 2 * offset; return rectangle; case SelectionBorderGlyphType.Left: rectangle.Offset(-offset, -offset); rectangle.Height += 2 * offset; return rectangle; case SelectionBorderGlyphType.Right: rectangle.Offset(offset, -offset); rectangle.Height += 2 * offset; return rectangle; case SelectionBorderGlyphType.Body: return originalBounds; } } return rectangle; }
public static Rectangle GetBoundsForSelectionType(Rectangle originalBounds, SelectionBorderGlyphType type) { return GetBoundsForSelectionType(originalBounds, type, SELECTIONBORDERSIZE, SELECTIONBORDEROFFSET); }
internal SelectionBorderGlyph(Rectangle controlBounds, SelectionRules rules, SelectionBorderGlyphType type, Behavior?behavior) : base(behavior) { InitializeGlyph(controlBounds, rules, type); }
public static Rectangle GetBoundsForSelectionType(Rectangle originalBounds, SelectionBorderGlyphType type) { return(GetBoundsForSelectionType(originalBounds, type, SELECTIONBORDERSIZE, SELECTIONBORDEROFFSET)); }
private void InitializeGlyph(Rectangle controlBounds, SelectionRules selRules, SelectionBorderGlyphType type) { rules = SelectionRules.None; hitTestCursor = Cursors.Default; //this will return the rect representing the bounds of the glyph bounds = DesignerUtils.GetBoundsForSelectionType(controlBounds, type); hitBounds = bounds; // The hitbounds for the border is actually a bit bigger than the glyph bounds switch (type) { case SelectionBorderGlyphType.Top: if ((selRules & SelectionRules.TopSizeable) != 0) { hitTestCursor = Cursors.SizeNS; rules = SelectionRules.TopSizeable; } // We want to apply the SELECTIONBORDERHITAREA to the top and the bottom of the selection border glyph hitBounds.Y -= (DesignerUtils.SELECTIONBORDERHITAREA - DesignerUtils.SELECTIONBORDERSIZE) / 2; hitBounds.Height += DesignerUtils.SELECTIONBORDERHITAREA - DesignerUtils.SELECTIONBORDERSIZE; break; case SelectionBorderGlyphType.Bottom: if ((selRules & SelectionRules.BottomSizeable) != 0) { hitTestCursor = Cursors.SizeNS; rules = SelectionRules.BottomSizeable; } // We want to apply the SELECTIONBORDERHITAREA to the top and the bottom of the selection border glyph hitBounds.Y -= (DesignerUtils.SELECTIONBORDERHITAREA - DesignerUtils.SELECTIONBORDERSIZE) / 2; hitBounds.Height += DesignerUtils.SELECTIONBORDERHITAREA - DesignerUtils.SELECTIONBORDERSIZE; break; case SelectionBorderGlyphType.Left: if ((selRules & SelectionRules.LeftSizeable) != 0) { hitTestCursor = Cursors.SizeWE; rules = SelectionRules.LeftSizeable; } // We want to apply the SELECTIONBORDERHITAREA to the left and the right of the selection border glyph hitBounds.X -= (DesignerUtils.SELECTIONBORDERHITAREA - DesignerUtils.SELECTIONBORDERSIZE) / 2; hitBounds.Width += DesignerUtils.SELECTIONBORDERHITAREA - DesignerUtils.SELECTIONBORDERSIZE; break; case SelectionBorderGlyphType.Right: if ((selRules & SelectionRules.RightSizeable) != 0) { hitTestCursor = Cursors.SizeWE; rules = SelectionRules.RightSizeable; } // We want to apply the SELECTIONBORDERHITAREA to the left and the right of the selection border glyph hitBounds.X -= (DesignerUtils.SELECTIONBORDERHITAREA - DesignerUtils.SELECTIONBORDERSIZE) / 2; hitBounds.Width += DesignerUtils.SELECTIONBORDERHITAREA - DesignerUtils.SELECTIONBORDERSIZE; break; } }
internal LockedBorderGlyph(Rectangle controlBounds, SelectionBorderGlyphType type) : base(null) { this.InitializeGlyph(controlBounds, type); }