예제 #1
0
        /// <summary>
        /// Adds a new column. The column width is calculated based on the given <paramref name="value"/>.
        /// <list type="bullet">
        ///     <item>Auto - The width is calculated automatically.</item>
        ///     <item>* - The column grabs all available space.</item>
        ///     <item>125 - The column has a fixed width of 125.</item>
        /// </list>
        /// </summary>
        /// <param name="value">Value of column definition</param>
        /// <exception cref="ArgumentNullException">If <paramref name="value"/> is NULL or empty</exception>
        /// <exception cref="FormatException">If <paramref name="value"/> cannot be parsed</exception>
        void IGridPanel.AddColumnDefinition(string value)
        {
            ColumnDefinition columnDefinition = new ColumnDefinition(value);
            ColumnStyle      columnStyle      = new ColumnStyle();
            SizeBehavior     mode             = columnDefinition.Mode;

            columnStyle.SizeType = mode == SizeBehavior.Auto
                ? SizeType.AutoSize
                : (mode == SizeBehavior.Fill ? SizeType.Percent : SizeType.Absolute);

            if (columnStyle.SizeType == SizeType.Percent)
            {
                columnStyle.Width = 1.0f;
            }

            if (columnStyle.SizeType == SizeType.Absolute)
            {
                columnStyle.Width = columnDefinition.Width;
            }

            ColumnStyles.Add(columnStyle);

            if (ColumnStyles.Count > ColumnCount)
            {
                ((IGridPanel)this).GridColumns++;
            }
        }
예제 #2
0
        public void Draw(GeometryManager geometries)
        {
            float lifetime = 1 - (float)(Lifetime / InitialLifetime);

            geometries.SpriteGeometry.Size  = SizeBehavior.Calculate(this, lifetime);
            geometries.SpriteGeometry.Color = new Color(
                ColorBehavior.Calculate(this, lifetime),
                (byte)(255 * AlphaBehavior.Calculate(this, lifetime)));
            geometries.SpriteGeometry.DrawSprite(Position.NumericValue);
        }
예제 #3
0
 public RectCard() : base()
 {
     this.SizeBehavior = new SizeBehavior(30, 30);
 }