private void button1_Click(object sender, EventArgs e) { if (groupBox2.Controls.Count > 1) { groupBox3.Dispose(); } try { oput = Math.Sqrt(Convert.ToInt32(textBox3.Text)); output = (int)oput; iteration = Convert.ToInt32(textBox1.Text); epsilon = Convert.ToDouble(textBox2.Text); nn = new NeuralNetwork(output, iteration, epsilon, (Functions)function); OpenFileDialog ofd = new OpenFileDialog(); if (ofd.ShowDialog() == DialogResult.OK) { fileName = ofd.FileName; nn.ReadDataFromFile(ofd.FileName); nn.Normalize = true; nn.StartLearning(); Bitmap img = new Bitmap(output, output); colorM = nn.ColorSOFM(); for (int i = 0; i < colorM.GetLength(0); i++) { for (int j = 0; j < colorM.GetLength(1); j++) { Color d; string c = colorM[i, j].Name; if (c == "ButtonFace") { d = Color.FromArgb(255, 226, 232, 232); } else { d = Color.FromName(c); } img.SetPixel(j, i, d); } } Bitmap img2 = new Bitmap(img); BitmapFilter.Scale(ref img, ref img2, output * 20, output * 20); pictureBox1.Image = img2; pictureBox1.Paint += new PaintEventHandler(AddLinesPaint); CreateLegendGroup(); AddInputValues(); } } catch (Exception) { MessageBox.Show("Input error!", "FATAL ERROR!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); textBox1.Text = textBox2.Text = textBox3.Text = ""; foreach (RadioButton a in groupBox1.Controls.OfType <RadioButton>()) { a.Checked = false; } } }
/// <summary> /// Releases all resources used by the wizard container. /// </summary> /// <param name="disposing">The object that is being explicitly disposed of.</param> protected override void Dispose(bool disposing) { if (disposing) { if (_buttons != null) { _buttons.Dispose(); } if (_groupBox != null) { _groupBox.Dispose(); } if (_container != null) { foreach (IDisposable d in _container.Values) { d.Dispose(); } } } base.Dispose(disposing); }