Esempio n. 1
0
 /// <summary>
 /// l(ocation) is 0,0 by default, and s(ize) can be set to screen size
 /// </summary>
 /// <param name="l"></param>
 /// <param name="s"></param>
 public Menu(Point l, Point s)
 {
     menuItems     = new List <MenuItem>();
     spacing       = SPACING.SPACING_REGULAR;
     SelectedIndex = -1;
     Loc           = l;
     size          = s;
 }
Esempio n. 2
0
        /*
         * Method:  centerLLAP
         * Purpose: To center a line of text across 80 characters for
         *          displaying on the screen in between the "Vulcan LLAP"
         *          salute
         *
         * Input:   line (string)
         * Output:  centered (string)
         */
        private static string centerLLAP(string line)
        {
            const string SPACING =
                "                                        ";
            const string LLAP         = "\\\\// {0} \\\\//";
            const int    SCREEN_WIDTH = 80;
            const int    IN_HALF      = 2;

            string centered = "";
            int    spaces   = 0;

            // Place input string in between \\//s
            centered = string.Format(LLAP, line);

            // If combined string is under screen width, center it
            if (centered.Length < SCREEN_WIDTH)
            {
                // Calculate the offset spaces
                spaces   = (SCREEN_WIDTH - centered.Length) / IN_HALF;
                centered = SPACING.Substring(0, spaces) + centered;
            }

            return(centered);
        }
Esempio n. 3
0
 public void SetSpacing(SPACING s)
 {
     spacing = s;
     AlignAll();
 }