private void TreeView_AfterSelect(object sender, TreeViewEventArgs e) { CurrentQuestionView?.Hide(); CurrentQuestionView = treeView.SelectedNode.Tag as QuestionBlockView; CurrentQuestionView.Show(); }
private void AddQuestuion_Click(object sender, EventArgs e) { var view = new QuestionBlockView(); questionPanel.Controls.Add(view); treeView.Nodes.Add("Новый вопрос"); treeView.Nodes[treeView.Nodes.Count - 1].Tag = view; view.Tag = treeView.Nodes[treeView.Nodes.Count - 1]; view.Visible = false; }
public TestCreateForm() { InitializeComponent(); var view = new QuestionBlockView(); questionPanel.Controls.Add(view); treeView.Nodes.Add("Вопрос номер 1"); treeView.Nodes[0].Tag = view; view.Tag = treeView.Nodes[0]; view.SetTitle("Вопрос номер 1"); CurrentQuestionView = view; }