예제 #1
0
        public Form1()
        {
            InitializeComponent();
            Program.cont = false;
            chkHist      = new MyList();
            tlp          = tableLayoutPanel1;
            int ii = 0;

            rb[ii++] = checkBox1;
            rb[ii++] = checkBox2;
            rb[ii++] = checkBox3;
            rb[ii++] = checkBox4;
            for (int i = 0; i < rb.Length; i++)
            {
                mim[i]      = Image.FromFile("..\\..\\mark" + i + ".bmp");
                rb[i].Image = mim[i];
                rb[i].Text  = "";
            }

            cim          = Image.FromFile("..\\..\\card.bmp");
            pb1          = pictureBox1;
            pb1.Image    = cim;
            pb1.SizeMode = PictureBoxSizeMode.AutoSize;
            pb1.Anchor   = AnchorStyles.Right;
            pb2          = (MyCard)pictureBox2;
            pb2.Image    = cim;
            pb2.SizeMode = PictureBoxSizeMode.AutoSize;
            pb2.Anchor   = AnchorStyles.Right;

            //lb = new Label();
            lb          = label1;
            lb.Font     = new Font("SansSerif", 50, FontStyle.Bold);
            lb.AutoSize = true;
            lb.Anchor   = AnchorStyles.None;
            lb.Parent   = tlp;

            //tlp.SetColumnSpan(pb1, 2);
            tlp.SetColumnSpan(lb, 2);

            Random rn = new Random();

            pb1.num = rn.Next(4);
            pb2.num = rn.Next(4);
            while (pb2.num == pb1.num)
            {
                pb2.num = rn.Next(4);
            }

            //pb.Click += new EventHandler(pb_Click);
        }
예제 #2
0
        public void pb_Click(Object sender, EventArgs e)
        {
            MyCard tp = (MyCard)sender;

            if (tp.isOpen == false)
            {
                tp.isOpen = true;
                tp.Image  = mim[tp.num];
            }
            judgement();

            /*else
             * {
             *  tp.isOpen = false;
             *  lb.Text = "";
             *  tp.Image = cim;
             *
             *  Random rn = new Random();
             *  tp.num = rn.Next(4);
             * }*/
        }