/// <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;
			}
			
		}
Exemple #2
0
        /// <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;
            }
        }
		/// <summary>Sets a round corner to this border.</summary>
		/// <param name="corner">The property that it's going onto or coming from.</param>
		/// <param name="position">The type of corner that it is.</param>
		/// <param name="radius">The border radius.</param>
		public void SetCorner(ref RoundCorner corner,RoundCornerPosition position,int radius){
			
			if(radius<=0){
				
				if(corner!=null){
					// Clear it:
					corner=null;
					
					// Got rounded corners now?
					bool hasRoundedCorners=(
						TopLeft!=null || TopRight!=null ||
						BottomLeft!=null || BottomRight!=null
					);
					
					if(!hasRoundedCorners){
						// Clear the corner set:
						Border.Corners=null;
					}
					
				}
				
				return;
			}
			
			// A corner is now required:
			
			if(corner==null){
				
				// Create it now:
				corner=new RoundCorner(this,position);
				
			}
			
			// Apply the radius:
			corner.Radius=radius;
			
		}
Exemple #4
0
        public void SetCorner(RoundCornerPosition position, int 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;
            }
        }
        /// <summary>Sets a round corner to this border.</summary>
        /// <param name="corner">The property that it's going onto or coming from.</param>
        /// <param name="position">The type of corner that it is.</param>
        /// <param name="radius">The border radius.</param>
        public void SetCorner(ref RoundCorner corner, RoundCornerPosition position, float radius)
        {
            if (radius <= 0)
            {
                if (corner != null)
                {
                    // Clear it:
                    corner = null;

                    // Got rounded corners now?
                    bool hasRoundedCorners = (
                        TopLeft != null || TopRight != null ||
                        BottomLeft != null || BottomRight != null
                        );

                    if (!hasRoundedCorners)
                    {
                        // Clear the corner set:
                        Border.Corners = null;
                    }
                }

                return;
            }

            // A corner is now required:

            if (corner == null)
            {
                // Create it now:
                corner = new RoundCorner(this, position);
            }

            // Apply the radius:
            corner.Radius     = radius;
            corner.ValueScale = Computed.RenderData.ValueScale;
        }
		public void SetCorner(RoundCornerPosition position,int 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;
			}
			
		}