private void FormContainer_Load(object sender, EventArgs e) { var child = new FormChild(); child.MdiParent = this; child.Show(); }
private void ShowNewForm(object sender, EventArgs e) { // Create a new instance of the child form. FormChild childForm = new FormChild(new double[] { 0.0 }); // Make it a child of this MDI form before showing it. childForm.Text = "Данные " + childFormNumber++; childForm.MdiParent = this; childForm.WindowState = FormWindowState.Maximized; childForm.Show(); }
private void FormContainer_Load(object sender, EventArgs e) { var child = new FormChild(); child.MdiParent = this; child.Show(); // if you wish to specify the position, size, Anchor or Dock styles // of the newly created child form you can, like you would normally do // for any control child.Location = new Point(50, 50); child.Size = new Size(100, 100); child.Anchor = AnchorStyles.Top | AnchorStyles.Right; }
private void toolNormZn_Click(object sender, EventArgs e) { FormAskNormalParams fAskParams = new FormAskNormalParams(); if (fAskParams.ShowDialog() != DialogResult.OK) { return; } FormChild childForm = new FormChild( StatisticsProcessor.GenerateNormal( fAskParams.a, fAskParams.σ, fAskParams.n)); childForm.MdiParent = this; childForm.WindowState = FormWindowState.Maximized; childForm.Text = "Нормальный " + childFormNumber.ToString(); childFormNumber++; childForm.Show(); }
private void toolRavnomZn_Click(object sender, EventArgs e) { FormAskZnSelection fAskParams = new FormAskZnSelection(); if (fAskParams.ShowDialog() != DialogResult.OK) { return; } FormChild childForm = new FormChild( StatisticsProcessor.GenerateRavnom( fAskParams.a, fAskParams.b, fAskParams.n)); childForm.MdiParent = this; childForm.WindowState = FormWindowState.Maximized; childForm.Text = "Равномерный " + childFormNumber.ToString(); childFormNumber++; childForm.Show(); }
private void buttonSort_Click(object sender, EventArgs e) { if (ActiveMdiChild is FormChild) { FormChild activeChild = ActiveMdiChild as FormChild; double[] sortedData = activeChild.DataAsRow; Array.Sort <double>(sortedData); activeChild.AddRow("Сортировка", sortedData); DialogResult dlgResult = MessageBox.Show("Отдельно?", "Создать новую упорядоченную выборку?", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1); if (dlgResult == DialogResult.Yes) { FormChild formChild = new FormChild(sortedData); formChild.MdiParent = this; formChild.Text = string.Format("{0} ~ Упорядоченная", ActiveMdiChild.Text, childFormNumber++); formChild.Show(); } } }
private void buttonCheckOutstanding(object sender, EventArgs e) { if (ActiveMdiChild is FormChild) { FormChild activeMdiChild = ActiveMdiChild as FormChild; double[] clearData; double[] worthless = StatisticsProcessor.CheckOutstanding(activeMdiChild.DataAsRow, out clearData, 0.05f); if (worthless != null) { if (worthless.Length > 1) { activeMdiChild.PrintLine("Обнаружены резковыделяющиеся значения.", true); } else { activeMdiChild.PrintLine("Обнаружено резковыделяющееся значение: " + worthless[0].ToString(), true); } activeMdiChild.AddRow("Резковыделяющиеся значения:", worthless); DialogResult dlgResult = MessageBox.Show("Отдельно?", "Выделить значимые элементы в новую выборку?", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1); if (dlgResult == DialogResult.Yes) { FormChild formChild = new FormChild(clearData); formChild.MdiParent = this; formChild.Text = string.Format("{0} ~ {1}", activeMdiChild.Text, childFormNumber++); formChild.Show(); } } else { activeMdiChild.PrintLine("Выборка не засорена резковыделяющимися значениями.", true); } } }
private void OpenFile(object sender, EventArgs e) { OpenFileDialog openFileDialog = new OpenFileDialog(); openFileDialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Personal); openFileDialog.Filter = "CSV Files (*.csv)|*.csv|All Files (*.*)|*.*"; if (openFileDialog.ShowDialog(this) == DialogResult.OK) { List <double[]> dataCollection = new List <double[]>(); string FileName = openFileDialog.FileName; bool success = false; StreamReader f1 = null; while (!success) { try { f1 = new StreamReader(FileName); success = true; } catch (IOException /* exc*/) { if (MessageBox.Show("Произошла ошибка во время чтения файла " + FileName, "Ошибка чтения", MessageBoxButtons.RetryCancel, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1) == DialogResult.Retry) { continue; } else { return; } //exc.Message } } while (!f1.EndOfStream) { string s1 = f1.ReadLine(); string[] strs = s1.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries); List <double> dataLine = new List <double>(); try { foreach (string strVal in strs) { dataLine.Add(double.Parse(strVal)); } } catch (FormatException exception) { MessageBox.Show("Wrong double number in file " + FileName + "."); f1.Close(); throw exception; } dataCollection.Add(dataLine.ToArray()); } f1.Close(); FormChild childForm = new FormChild(dataCollection.ToArray()); childForm.MdiParent = this; childForm.WindowState = FormWindowState.Maximized; childForm.Text = FileName; childForm.Show(); } }