Esempio n. 1
0
        private void init_AdditionsTitleCard()
        {
            checkButtons           = new CheckButtonLsn();
            checkButtons.lsn       = lessonList;
            checkButtons.Checked   = false;
            checkButtons.Location  = new Point(WIDTH - checkButtons.Width * 2, PROP_TITLE_HIEGHT - checkButtons.Height + 5);
            checkButtons.OnChange += ((s, e) => {
                CheckButtonLsn cb = s as CheckButtonLsn;
                if (cb.Checked)
                {
                    for (int i = 0; i < lessonList.amount(); i++)
                    {
                        lessonSelected.Add(lessonList[i]);
                    }
                }
                else
                {
                    lessonSelected = new List <Lesson>();
                }
                panelCoursesList.setSelectedLessons_callback();
            });
            card.Controls.Add(checkButtons);

            btn_edit             = new CheckButton();
            btn_edit.Text        = "עריכה";
            btn_edit.AutoSize    = false;
            btn_edit.Width       = W_MEDIUM;
            btn_edit.Height      = PROP_TITLE_HIEGHT;
            btn_edit.Font        = new Font(FONT_TEXT, 12, FontStyle.Bold);
            btn_edit.BackColor   = Color.Transparent;
            btn_edit.ForeColor   = colors[id % colors.GetLength(0), 0];
            btn_edit.FlatStyle   = FlatStyle.Flat;
            btn_edit.Location    = new Point(5, btn_edit.Height / 3 - 1);
            btn_edit.btn_checked = false;
            btn_edit.id          = id;

            btn_edit.Click += ((s, e) => {
                CheckButton btn = s as CheckButton;
                btn.btn_checked = !btn.btn_checked;
                if (btn.btn_checked)
                {
                    btn_edit.BackColor = colors[id % colors.GetLength(0), 0];
                    btn_edit.ForeColor = Color.Transparent;
                    btn_edit.Text = "שמירה";
                }
                else
                {
                    btn_edit.BackColor = Color.Transparent;
                    btn_edit.ForeColor = colors[id % colors.GetLength(0), 0];
                    btn_edit.Text = "עריכה";
                }
                title.ChangeState();
                year.ChangeState();
                changeEditState();
            });

            card.Controls.Add(btn_edit);
            btn_edit.BringToFront();
        }