예제 #1
0
        /// <summary>
        /// 단어장 클릭 동작
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void label_Click(object sender, EventArgs e)
        {
            Label lbl    = sender as Label;
            int   lblNum = Array.IndexOf(label, lbl);

            if (!lblClicked[lblNum])
            {
                mwln[lblNum]          = new mainWordListName();
                mwln[lblNum].Name     = "mwln" + lblNum.ToString();
                mwln[lblNum].Location = new Point(lbl.Location.X + lbl.Width / 2 - (mwln[lblNum].Width / 2), lbl.Location.Y + lbl.Height);
                panel1.Controls.Add(mwln[lblNum]);

                mwln[lblNum].getInfoMainForm(this, lblNum);

                //뒤에 있는 컨트롤 위치 조정
                for (int i = lblNum + 1; i < lblCNT; i++)
                {
                    foreach (Control control in panel1.Controls)
                    {
                        if (control.Name == "mwln" + i.ToString())
                        {
                            mwln[i].Location = new Point(mwln[i].Location.X, mwln[i].Location.Y + mwln[i].Height);
                            break;
                        }
                    }

                    label[i].Location = new Point(label[i].Location.X, label[i].Location.Y + mwln[lblNum].Height);
                }
                lblClicked[lblNum] = !lblClicked[lblNum];
            }
            else
            {
                foreach (Control control in panel1.Controls)
                {
                    if (control.Name == "mwln" + lblNum.ToString())
                    {
                        panel1.Controls.Remove(control);

                        //뒤에 있는 컨트롤 위치 조정
                        for (int i = lblNum + 1; i < lblCNT; i++)
                        {
                            foreach (Control ctr in panel1.Controls)
                            {
                                if (ctr.Name == "mwln" + i.ToString())
                                {
                                    mwln[i].Location = new Point(mwln[i].Location.X, mwln[i].Location.Y - mwln[i].Height);
                                    break;
                                }
                            }

                            label[i].Location = new Point(label[i].Location.X, label[i].Location.Y - mwln[lblNum].Height);
                        }
                        lblClicked[lblNum] = !lblClicked[lblNum];
                        break;
                    }
                }
            }
        }
예제 #2
0
 /// <summary>
 /// 메인폼 정보를 wln에서 받음.
 /// </summary>
 /// <param name="wln"></param>
 public void getInfoWLN(mainWordListName wln)
 {
     form1  = wln.form1;
     lblNum = wln.lblNum;
     label  = wln.label;
 }