Exemplo n.º 1
0
        private void gvCauHoi_RowClick(object sender, DevExpress.XtraGrid.Views.Grid.RowClickEventArgs e)
        {
            pnLuaChon.Controls.Clear();
            if (flag)
            {
                rtbNoiDungCH.Text = string.Empty;
                int maCH = Int32.Parse(((DataRowView)cAUHOIBindingSource.Current)[0].ToString().Trim());
                if (maCH == 0)
                {
                    return;
                }

                CAUHOI         chRow = CauHoi.GetCauHoiByMaCH(maCH);
                List <LUACHON> lstLC = CauHoi.GetLuaChonByMaCH(maCH);

                rtbNoiDungCH.AppendText(chRow.NOIDUNG);
                lstLC.OrderBy(x => x.MALC);
                foreach (LUACHON lc in lstLC)
                {
                    RichTextBox rtb = new RichTextBox();

                    rtb.Multiline = true;
                    rtb.Text      = "Câu " + lc.MALC + " : " + lc.NOIDUNG;
                    rtb.Dock      = DockStyle.Top;
                    if (chRow.DAPAN.Equals(lc.MALC))
                    {
                        rtb.BackColor = Color.Green;
                    }

                    pnLuaChon.Controls.Add(rtb);
                    pnLuaChon.AutoScroll = true;
                    pnLuaChon.FireScrollEventOnMouseWheel = true;
                }
            }
        }
Exemplo n.º 2
0
        public void SetData()
        {
            if (LISTMACH.Count == 0)
            {
                return;
            }
            lblTenMonHoc.Text = "XE TRƯỚC BỘ ĐỀ MÔN : " + TTENMH;
            KHOA kh = Khoa.GetKhoaByMaKhoa(MAKHOA);

            lblTenKhoa.Text    = "KHOA : " + kh.TENKH;
            lblTrinhDo.Text    = TrinhDo.GetTDByMaTD(MATRINHDO).TENTD;
            lblThongTinBD.Text = "Thời gian : " + THOIGIANTHI.ToString() + " phút";

            RichTextBox    rtbCau = new RichTextBox();
            CAUHOI         ch     = null;
            List <LUACHON> lc     = null;

            for (int i = 0; i < LISTMACH.Count; i++)
            {
                ch = CauHoi.GetCauHoiByMaCH(LISTMACH[i]);
                if (rtbCau.Text.Trim() == string.Empty)
                {
                    rtbCau.Text = "Câu " + (i + 1).ToString() + " : ";
                    rtbCau.AppendText(Environment.NewLine + "    " + ch.NOIDUNG);
                }
                else
                {
                    rtbCau.AppendText(Environment.NewLine + "Câu " + (i + 1).ToString() + " : " + ch.NOIDUNG);
                }
                lc = CauHoi.GetLuaChonByMaCH(LISTMACH[i]);
                for (int j = 0; j < lc.Count; j++)
                {
                    rtbCau.AppendText(Environment.NewLine + "     Câu " + KeyConst.LUACHON[j] + " : " + lc[j].NOIDUNG);
                }
            }
            rtbCau.Dock = DockStyle.Fill;
            FontStyle newFontStyle = (FontStyle)(FontStyle.Bold);

            rtbCau.Font           = new Font("Times New Rowman", 25, newFontStyle);
            pnBaiThi.AutoScroll   = true;
            rtbCau.SelectionStart = 0;
            pnBaiThi.Controls.Add(rtbCau);
        }
Exemplo n.º 3
0
        private void FormThi_Load(object sender, EventArgs e)
        {
            // TODO: This line of code loads data into the 'dtsTTN.CT_BAITHI' table. You can move, or remove it, as needed.
            this.cT_BAITHITableAdapter.Fill(this.dtsTTN.CT_BAITHI);
            bANGDIEMTableAdapter.Fill(this.dtsTTN.BANGDIEM);
            MyTimer.Interval = (1000); // 1 mins
            MyTimer.Tick    += new EventHandler(t_Tick);
            MyTimer.Start();

            if (MaBD != -1)
            {
                BDThiTam = BoDe.LayBDThi(MaBD);
                if (BDThi == null)
                {
                    return;
                }
                CAUHOITHI = new List <HoTroLayCauHoiThi>();
                HoTroLayCauHoiThi htCHThi  = null;
                Panel             pnCauHoi = null;
                int i = BDThiTam.Count;
                while (BDThiTam.Count != 0)
                {
                    htCHThi = new HoTroLayCauHoiThi();
                    int           r  = rnd.Next(BDThiTam.Count);
                    HoTroLayBDThi ht = BDThiTam[r];
                    BDThi.Add(ht);
                    CAUHOI         cauHoi  = CauHoi.GetCauHoiByMaCH(ht.MaCauHoi);
                    List <LUACHON> luachon = CauHoi.GetLuaChonByMaCH(ht.MaCauHoi);

                    pnCauHoi          = new Panel();
                    pnCauHoi.AutoSize = true;
                    pnCauHoi.Dock     = DockStyle.Top;

                    Label lb = new Label();
                    lb.AutoSize = true;
                    FontStyle newFontStyle = (FontStyle)(FontStyle.Bold);
                    lb.Font = new Font("Times New Rowman", 25, newFontStyle);
                    lb.Text = "Câu " + i + " : " + cauHoi.NOIDUNG;

                    RadioButton rGLuaChon = null;

                    foreach (LUACHON lc in luachon)
                    {
                        rGLuaChon          = new RadioButton();
                        rGLuaChon.AutoSize = true;
                        rGLuaChon.Name     = lc.MALC.Trim() + "-" + cauHoi.MACH.ToString().Trim();
                        rGLuaChon.Font     = new Font("Times New Rowman", 25, newFontStyle);
                        // update dap an neu thay doi lua chon
                        rGLuaChon.CheckedChanged += new EventHandler(LuaChon_Click);
                        //rGLuaChon.Add(new RadioGroupItem(lc.MALC.ToString(), "Câu " + lc.MALC.ToString() + " : " + lc.NOIDUNG));
                        rGLuaChon.Text = "Câu " + lc.MALC.ToString() + " : " + lc.NOIDUNG;
                        rGLuaChon.Dock = DockStyle.Bottom;
                        rGLuaChon.Focus();
                        pnCauHoi.Controls.Add(rGLuaChon);
                    }

                    lb.Dock = DockStyle.Top;
                    pnCauHoi.Controls.Add(lb);
                    pnThi.Controls.Add(pnCauHoi);

                    htCHThi.MaCH      = cauHoi.MACH;
                    htCHThi.STT       = ht.SoTT;
                    htCHThi.DapAn     = cauHoi.DAPAN;
                    htCHThi.STTKhiThi = i - 1;

                    CAUHOITHI.Add(htCHThi);
                    BDThiTam.RemoveAt(r);
                    i--;
                }
            }
            pnThi.AllowDrop  = true;
            pnThi.AutoScroll = true;
        }