Example #1
0
        private void centeringButton_Clicked(object sender, EventArgs e)
        {
            var pos = tableLayoutPanelCentering.GetCellPosition((Control)sender);

            xc = (Centering)pos.Column;
            yc = (Centering)(2 - pos.Row);
            foreach (Control child in tableLayoutPanelCentering.Controls)
            {
                ((Button)child).BackColor = Control.DefaultBackColor;
            }
            ((Button)sender).BackColor = Color.AliceBlue;
            refreshOffset();
            refreshImage();
        }
Example #2
0
 private int topLeftPx(int center, int size, int extent, Centering centering)
 {
     if (centering == Centering.Center)
     {
         return(center - size / 2);
     }
     else if (centering == Centering.Min)
     {
         return(center - extent / 2);
     }
     else
     {
         return(center + extent / 2 - size);
     }
 }
Example #3
0
    /// <summary>
    /// Displays a message, centered either vertically or horizontally in the screen
    /// </summary>
    /// <param name="msg"></param>
    /// <param name="how"></param>
    /// <param name="otherCoordValue"></param>
    /// <param name="lifeTime"></param>
    /// <param name="startColor"></param>
    /// <param name="endColor"></param>
    public StringItem( string msg, Centering how, int otherCoordValue, float lifeTime, Color startColor, Color endColor )
    {
        // x and y to use
        int x, y;
        if( how == Centering.Horizontal )
        {
          // he only wants it horizontally centered.
          x = ScreenWriter.GetCenteredX( msg );

          // the coordValue he passed must be intended value for 'y'
          y = otherCoordValue;
        }
        else if( how == Centering.Vertical )
        {
          // center vertically only
          x = otherCoordValue;
          y = ScreenWriter.GetCenteredY( msg );
        }
        else
        {
          // center both, other coordinate value is ignored.
          x = ScreenWriter.GetCenteredX( msg );
          y = ScreenWriter.GetCenteredY( msg );
        }

        // now make the string item
        message = msg;
        pos = new Vector2( x, y );
        life = lifeTime;
        initColor = startColor;
        finalColor = endColor;
        if( lifeTime == 0 )
          fades = false;
        else
          fades = true;
        isActive = true;
    }
Example #4
0
 public StringItem( string msg, Centering how, int otherCoordValue, float lifeTime, Color color )
     : this(msg, how, otherCoordValue, lifeTime, color, DEFAULT_END_COLOR)
 {
 }
Example #5
0
 public StringItem( string msg, Centering how, int otherCoordValue, float lifeTime )
     : this(msg, how, otherCoordValue, lifeTime, DEFAULT_START_COLOR, DEFAULT_END_COLOR)
 {
 }
Example #6
0
 /// <summary>
 /// Displays a message, centered either vertically or horizontally in the screen.
 /// </summary>
 /// <param name="msg">Message string to display</param>
 /// <param name="how">What type of centering do you want?  You can choose BOTH, you know</param>
 /// <param name="otherCoordValue">Value of for axis you are NOT trying to center</param>
 public StringItem( string msg, Centering how, int otherCoordValue )
     : this(msg, how, otherCoordValue, DEFAULT_LIFETIME, DEFAULT_START_COLOR, DEFAULT_END_COLOR)
 {
 }
Example #7
0
 public StringItem( string msg, Centering how )
     : this(msg, how, 0, DEFAULT_LIFETIME, DEFAULT_START_COLOR, DEFAULT_END_COLOR)
 {
 }