private void Lesson_Click(object sender, EventArgs e) { SelectedElement = (LessonControl)sender; LessonControl StatusLessonControl = new LessonControl(); StatusLessonControl.Location = new Point(0, 0); StatusLessonControl.ControlColor = SelectedElement.ControlColor; StatusLessonControl.LessName = SelectedElement.LessName; StatusLessonControl.Picture = SelectedElement.Picture; StatusLessonControl.Theories = SelectedElement.Theories; StatusLessonControl.Questions = SelectedElement.Questions; LessonName.Text = SelectedElement.LessName; StatusElement = StatusLessonControl; SelectedElementPanel.Controls.Clear(); SelectedElementPanel.Controls.Add(StatusLessonControl); LessonConentLayoutPanel.Controls.Clear(); LessonConentLayoutPanel.Controls.AddRange(StatusLessonControl.Theories.ToArray()); LessonConentLayoutPanel.Controls.AddRange(StatusLessonControl.Questions.ToArray()); }
private void Element1_Click(object sender, EventArgs e) { LessonControl lesson = new LessonControl(); TestTrainingPanel.Controls.Add(lesson); lesson.ContextMenuStrip = contextMenuStrip; lesson.Click += Lesson_Click; lesson.SetOtherChildrenControlClick(Lesson_Click); lesson.Position = Position; Position++; }