private void Qitem_CheckedChange(UCQuestionListItem item, IQuestion question) { if (item.Checked) { var q = question.Clone(); var qitem = new UCQuestionListItem(q, question.RegisterTime.ToLocalTime().ToPrettyTime(), flpSelectedQuestions.Controls.Count + 1); qitem.HasRemoveButton = false; qitem.Width = multiTabPage.Width - 50; qitem.RightToLeft = RightToLeft.Yes; qitem.Anchor = AnchorStyles.Right | AnchorStyles.Left; qitem.Resize += (s, ev) => { qitem.MaximumSize = new Size(Width - 50, 0); }; qitem.Name = question.Id; qitem.Checked = true; qitem.CheckedChange += SelectedQitem_CheckedChange; qitem.MouseDown += (s, ev) => { qitem.DoDragDrop(qitem, DragDropEffects.Move); }; qitem.QuestionEdited += Qitem_QuestionEdited; qitem.CausesValidation = false; qitem.Cursor = Cursors.Hand; item.Tag = q; //qitem.AllowDrop = true; flpSelectedQuestions.Controls.Add(qitem); selectedQuestions.Add(q); list.Add(qitem); } else if (selectedQuestions.Contains((IQuestion)item.Tag)) { var q = (IQuestion)item.Tag; var controls = flpSelectedQuestions.Controls; controls.Remove(controls.Find(question.Id, false)[0]); selectedQuestions.Remove(q); item.Tag = null; RefreshNumberInFlpSelected(); } }