private void checkedListBox2_ItemCheck(object sender, ItemCheckEventArgs e) { //if this graph doesnt exist - create a form with it //and add it into the list //else close existing form if (!checkedListBox2.GetItemChecked(checkedListBox2.SelectedIndex)) { string sGraphicsName = checkedListBox2.Items[checkedListBox2.SelectedIndex].ToString(); string[] sSplitedGraphicsName = sGraphicsName.Split('/'); List <string> sAxis = new List <string>(); foreach (string s in sSplitedGraphicsName) { sAxis.Add(s); } graphForm = new GraphicsForm(); listGraphicsForm.Add(graphForm); graphForm.Tag = iNumInList; iNumInList++; graphForm.Text = sGraphicsName; graphForm.CreateChart(sGraphicsName, sAxis[0], sAxis[1], "", 0, 0); graphForm.iNumItemToUncheck = checkedListBox2.SelectedIndex; graphForm.SetItemChecked = new DelegateCheckedListBox2SetItemChecked(checkedListBox2.SetItemChecked); graphForm.Show(mForm.dockPanel1, DockState.Document); } else { foreach (GraphicsForm gForm in listGraphicsForm) { if (gForm.iNumItemToUncheck == checkedListBox2.SelectedIndex) { listGraphicsForm[(int)gForm.Tag].Hide(); } } } }
private void checkedListBox2_ItemCheck(object sender, ItemCheckEventArgs e) { //if this graph doesnt exist - create a form with it //and add it into the list //else close existing form if (!checkedListBox2.GetItemChecked(checkedListBox2.SelectedIndex)) { string sGraphicsName = checkedListBox2.Items[checkedListBox2.SelectedIndex].ToString(); string[] sSplitedGraphicsName = sGraphicsName.Split('/'); List<string> sAxis = new List<string>(); foreach (string s in sSplitedGraphicsName) { sAxis.Add(s); } graphForm = new GraphicsForm(); listGraphicsForm.Add(graphForm); graphForm.Tag = iNumInList; iNumInList++; graphForm.Text = sGraphicsName; graphForm.CreateChart(sGraphicsName, sAxis[0], sAxis[1], "", 0, 0); graphForm.iNumItemToUncheck = checkedListBox2.SelectedIndex; graphForm.SetItemChecked = new DelegateCheckedListBox2SetItemChecked(checkedListBox2.SetItemChecked); graphForm.Show(mForm.dockPanel1, DockState.Document); } else { foreach (GraphicsForm gForm in listGraphicsForm) { if (gForm.iNumItemToUncheck == checkedListBox2.SelectedIndex) { listGraphicsForm[(int)gForm.Tag].Hide(); } } } }