public Comment(IToken token, CommentKind commentKind, IToken previous) { BestCandidate = null; Distance = 0; CommentKind = commentKind; Token = token; PreviousToken = previous; AnchorKind = AnchorKind.None; }
public Vector2 AnchorPosition(RectangleF parent, AnchorKind anchor, float x, float y, float width, float height) { float resolveX = 0; float resolveY = 0; switch (anchor) { case AnchorKind.TopLeft: resolveX = parent.X + x; resolveY = parent.Y + y; break; case AnchorKind.TopCenter: resolveX = parent.X + (parent.Width / 2) - (width / 2) + x; resolveY = parent.Y + y; break; case AnchorKind.TopRight: resolveX = parent.X + parent.Width - width - x; resolveY = parent.Y + y; break; case AnchorKind.CenterLeft: resolveX = parent.X + x; resolveY = parent.Y + (parent.Height / 2) - (height / 2) + y; break; case AnchorKind.Center: resolveX = parent.X + (parent.Width / 2) - (width / 2) + x; resolveY = parent.Y + (parent.Height / 2) - (height / 2) + y; break; case AnchorKind.CenterRight: resolveX = parent.X + parent.Width - width - x; resolveY = parent.Y + (parent.Height / 2) - (height / 2) + y; break; case AnchorKind.BottomLeft: resolveX = parent.X + x; resolveY = parent.Y + parent.Height - height - y; break; case AnchorKind.BottomCenter: resolveX = parent.X + (parent.Width / 2) - (width / 2) + x; resolveY = parent.Y + parent.Height - height - y; break; case AnchorKind.BottomRight: resolveX = parent.X + parent.Width - width - x; resolveY = parent.Y + parent.Height - height - y; break; } return(new Vector2(resolveX, resolveY)); }
public override object ConvertTo(System.ComponentModel.ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, System.Type destinationType) { if ((value == null)) { return(null); } AnchorKind valueCasted = ((AnchorKind)(value)); if ((valueCasted == AnchorKind.Rod)) { return("rod"); } if ((valueCasted == AnchorKind.Concrete)) { return("concrete"); } if ((valueCasted == AnchorKind.Helix)) { return("helix"); } if ((valueCasted == AnchorKind.MultiHelix)) { return("multiHelix"); } if ((valueCasted == AnchorKind.Screw)) { return("screw"); } if ((valueCasted == AnchorKind.Other)) { return("other"); } if ((valueCasted == AnchorKind.Unknown)) { return("unknown"); } throw new ArgumentOutOfRangeException("value"); }