Пример #1
0
        private void btnStart_Click(object sender, EventArgs e)
        {
            if (pbSuccess.Visible)
            {
                pDialog.Visible  = false;
                pSuccess.Visible = false;
            }
            else
            {
                btnStart.BackColor    = QuizTable.Violet;
                pDialog.UseWaitCursor = true;
                progressBar1.PerformStep();

                QuizTable.Initialize();
                progressBar1.PerformStep();

                InitializeGameField();
                progressBar1.PerformStep();

                InitializeSideElements();
                progressBar1.PerformStep();

                currentGame = new Game();
                progressBar1.PerformStep();

                pDialog.UseWaitCursor = false;

                // game loaded
                pSuccess.Visible = true;
                pSuccess.BringToFront();
                btnStart.BackColor = Color.Green;
            }
        }
Пример #2
0
        private void InitializeSideElements()
        {
            List <Element> e = QuizTable.ShuffleList(QuizTable.elems);

            for (int i = 0; i < e.Count; i++)
            {
                Panel p = new Panel();
                p.BackColor = QuizTable.Violet;
                p.Height    = ELEM_HEIGHT;
                p.Width     = ELEM_WIDTH;

                Label l = new Label();
                l.ForeColor = Color.White;
                l.Font      = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
                l.Text      = e[i].Symbol;
                l.Parent    = p;

                Label lf = new Label();
                lf.Parent    = p;
                lf.ForeColor = Color.White;
                lf.Location  = new System.Drawing.Point(0, 25);
                lf.Font      = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
                lf.Text      = e[i].Name;// Full Name

                // Bitmap
                Bitmap bm = new Bitmap(ELEM_WIDTH, ELEM_HEIGHT);
                p.DrawToBitmap(bm, new Rectangle(0, 0, ELEM_WIDTH, ELEM_HEIGHT));

                // PictureBox
                PictureBox pbx = new PictureBox();

                pbx.Height = ELEM_HEIGHT;
                pbx.Width  = ELEM_WIDTH;
                pbx.Left   = 2 * OFFSET;
                pbx.Top    = OFFSET + ELEM_HEIGHT * i + OFFSET * i;
                pbx.Cursor = Cursors.Hand;
                pbx.Image  = bm;

                Controls.Add(pbx);
                LearnToMove(pbx);
                pbx.Parent = pSide;
                pbx.Tag    = e[i].Symbol;
            }

            PictureBox pb = new PictureBox();

            pb.Image     = Image.FromFile("img\\mendeleev.jpg");
            pb.SizeMode  = PictureBoxSizeMode.StretchImage;
            pb.Location  = new System.Drawing.Point(pSide.Width + X_START + 8 * ELEM_WIDTH + 8 * OFFSET, Y_START);
            pb.Height    = 3 * ELEM_HEIGHT + 2 * OFFSET;
            pb.Width     = 2 * ELEM_WIDTH + OFFSET;
            pb.BackColor = Color.Gray;

            Controls.Add(pb);
        }
Пример #3
0
 public TablePage()
 {
     InitializeComponent();
     QuizTable.Initialize();
     InitializeGameField();
 }