コード例 #1
0
        private void CreateSimbolsButton()
        {
            int k = 0;

            foreach (var item in UIController.Instance.Turing.Alphabet)
            {
                if (item is '\0')
                {
                    continue;
                }
                Button button = new DoubleButton()
                {
                    Text         = item.ToString(),
                    Size         = new Size(35, 35),
                    Location     = new Point(k * 35, 0),
                    DialogResult = DialogResult.OK
                };
                k++;

                button.Click += Button_Click;

                ButtonOffBorder(ref button);
                this.Controls.Add(button);
            }
        }
コード例 #2
0
        private int SetPoint(int index, char value = ' ', int lastX = 0)
        {
            const int Width = 45;
            int       x     = lastX + 2;

            lastX += Width;

            Label label = new Label()
            {
                Font      = UIController.FormSettings.Font,
                Text      = index.ToString(),
                Width     = Width,
                Location  = new Point(x, panel1.Height / 2 - 30),
                TextAlign = ContentAlignment.BottomCenter,
            };

            UIController.Controls.Add(label);
            panel1.Controls.Add(label);

            const int Height = 35;
            Button    button = new DoubleButton()
            {
                Text      = value.ToString(),
                BackColor = UIController.FormSettings.EmptyTapeColor,
                Font      = UIController.FormSettings.Font,
                Size      = new Size(Width, Height),
                Location  = new Point(x, panel1.Height / 2),
                TextAlign = ContentAlignment.MiddleCenter,
                TabStop   = false,
                Tag       = index,
                Enabled   = true,
            };

            button.Click       += Button_Click;
            button.DoubleClick += Button_DoubleClick;
            ButtonOffBorder(ref button);
            UIController.Controls.Add(button);
            ButtonsTapePoint.Add(button);
            panel1.Controls.Add(button);
            return(lastX);
        }