Exemplo n.º 1
0
        private void createForm()
        {
            Array allColors           = Enum.GetNames(typeof(eColorType));
            int   numberOfColors      = allColors.Length;
            int   colorCounter        = 0;
            int   currentTopOfButton  = k_FrameDistance;
            int   currentLeftOfButton = k_FrameDistance;

            foreach (string buttonColor in allColors)
            {
                UserGuessButton newButton = new UserGuessButton(currentTopOfButton, currentLeftOfButton);
                newButton.Color  = Color.FromName(buttonColor);
                newButton.Click += newButton_Click;
                Controls.Add(newButton);
                currentLeftOfButton = newButton.Right + k_BlankSpaceBetweenButtons;
                if (colorCounter == (numberOfColors / 2) - 1)
                {
                    currentLeftOfButton = k_FrameDistance;
                    currentTopOfButton  = newButton.Bottom + k_BlankSpaceBetweenButtons;
                }
                colorCounter++;
            }
            int colorsHeight = currentTopOfButton + UserGuessButton.ButtonSize + k_FrameDistance;
            int colorsWidth  = currentLeftOfButton + k_FrameDistance - k_BlankSpaceBetweenButtons;

            ClientSize = new Size(colorsWidth, colorsHeight);
        }
Exemplo n.º 2
0
        private void createButtons()
        {
            int currentLeft = m_Left;

            for (int i = 0; i < WordGenerator.LengthOfWord; i++)
            {
                UserGuessButton newButton = new UserGuessButton();
                newButton.Top     = m_Top;
                newButton.Left    = currentLeft;
                newButton.Enabled = false;
                newButton.Click  += newButton_Click;
                r_Buttons.Add(newButton);
                currentLeft += newButton.Width + k_ButtonDistance;
            }
            m_Right = currentLeft + k_ButtonDistance;
        }