/// <summary>Creates a new rounded corner in the given position.</summary> public RoundCorner(RoundedCorners roundCorners, RoundCornerPosition position) { Position = position; RoundCorners = roundCorners; Border = roundCorners.Border; InverseBorder = roundCorners.InverseBorder; // Get the to index: ToIndex = (int)position; // Get the from index: FromIndex = ToIndex - 1; // May need to wrap it: if (FromIndex == -1) { FromIndex = 3; } }
public void SetCorner(RoundCornerPosition position, float radius) { if (Corners == null) { if (radius <= 0) { return; } // Create the corner set: Corners = new RoundedCorners(this); } // Set the corner: switch (position) { case RoundCornerPosition.TopLeft: // Top left corner: Corners.SetCorner(ref Corners.TopLeft, position, radius); break; case RoundCornerPosition.TopRight: // Top right corner: Corners.SetCorner(ref Corners.TopRight, position, radius); break; case RoundCornerPosition.BottomRight: // Bottom right corner: Corners.SetCorner(ref Corners.BottomRight, position, radius); break; case RoundCornerPosition.BottomLeft: // Bottom left corner: Corners.SetCorner(ref Corners.BottomLeft, position, radius); break; } }