Ejemplo n.º 1
0
 void CreateAnswerListButton()
 {
     for (int i = 0; i < indexList.Count; i++)
     {
         int    _i            = i;
         Button btnAnswerList = new Button();
         btnAnswerList.Text     = "정답";
         btnAnswerList.Size     = new Size(48, 23);
         btnAnswerList.Location = new Point(190, 63 + i * 80 - VerticalScroll.Value);
         btnAnswerList.Click   += new EventHandler(delegate
         {
             FormCollection fc = Application.OpenForms;
             foreach (Form frm in fc)
             {
                 if (frm.Name.Equals(indexList[_i].ToString()))
                 {
                     return;
                 }
             }
             frmAnswerList frmAnswerList = new frmAnswerList(indexList[_i]);
             frmAnswerList.Show();
             frmAnswerLists.Add(frmAnswerList);
             Clipboard.SetText(FileMng.wordDatas[indexList[_i]].word);
         });
         Controls.Add(btnAnswerList);
     }
     //frmAnswerList frmAnswerList = new frmAnswerList(i);
     //frmAnswerList.Show();
 }
Ejemplo n.º 2
0
        void AddWordSlot(int index)
        {
            Label lblWord = new Label();

            lblWord.Text     = (lblWordList.Count + 1) + ". " + FileMng.wordDatas[index].word;
            lblWord.Size     = new Size(200, 18);
            lblWord.Location = new Point(26, 112 + lblWordList.Count * 63);

            Button btnAnswerList = new Button();

            btnAnswerList.Text     = "정답";
            btnAnswerList.Size     = new Size(48, 23);
            btnAnswerList.Location = new Point(26, 130 + lblWordList.Count * 63);
            btnAnswerList.Click   += new EventHandler(delegate
            {
                FormCollection fc = Application.OpenForms;
                foreach (Form frm in fc)
                {
                    if (frm.Name.Equals(index.ToString()))
                    {
                        return;
                    }
                }
                frmAnswerList frmAnswerList = new frmAnswerList(index);
                frmAnswerList.Name          = index.ToString();
                frmAnswerList.Show();
                frmAnswerLists.Add(frmAnswerList);
                Clipboard.SetText(FileMng.wordDatas[index].word);
            });

            Button btnWordRemove = new Button();

            btnWordRemove.Text     = "삭제";
            btnWordRemove.Size     = new Size(48, 23);
            btnWordRemove.Location = new Point(78, 130 + lblWordList.Count * 63);
            btnWordRemove.Click   += new EventHandler(delegate
            {
                if (MessageBox.Show("단어를 삭제하시겠습니까?", "Notice", MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    Controls.Remove(lblWord);
                    Controls.Remove(btnAnswerList);
                    Controls.Remove(btnWordRemove);
                    removeList.Add(index);
                    indexList.Remove(index);
                    MdiParent.Text = frmMain.LearnedWords + "/" + FileMng.wordDatas.Count;
                }
            });

            lblWordList.Add(lblWord);
            Controls.Add(lblWord);
            Controls.Add(btnAnswerList);
            Controls.Add(btnWordRemove);
        }