private FractalForm createFractalForm(string text) { FractalForm frmchild = new FractalForm(); frmchild.MdiParent = this; //child Form will now hold a reference value to the tab control frmchild.TabCtrl = tabControl1; frmchild.Dock = System.Windows.Forms.DockStyle.Fill; frmchild.Location = new System.Drawing.Point(0, 0); frmchild.Text = text; //Add a Tabpage and enables it TabPage tp = new TabPage(); tp.Parent = tabControl1; tp.Text = frmchild.Text; tp.Show(); //child Form will now hold a reference value to a tabpage frmchild.TabPage = tp; //Activate the MDI child form childCount++; //Activate the newly created Tabpage tabControl1.SelectedTab = tp; frmchild.Show(); return frmchild; }
private void newtonFractalToolStripMenuItem_Click(object sender, EventArgs e) { FractalForm frmchild = new FractalForm(); frmchild.MdiParent = this; frmchild.Fractal = new NewtonFractalByIterationsRequired(); frmchild.Show(); frmchild.Text = "Newton Fractal - Iterations Required"; }
private void juliaFractalToolStripMenuItem_Click(object sender, EventArgs e) { FractalForm frmchild = new FractalForm(); frmchild.MdiParent = this; frmchild.Fractal = new JuliaFractal(); frmchild.Show(); frmchild.Text = "Julia Fractal"; }
private void loadFractalFromStream(Stream s) { // ToDo get type of fractal and load it! XmlDocument xmldoc = new XmlDocument(); xmldoc.Load(s); XmlNodeList nodes = xmldoc.GetElementsByTagName("frac"); if (nodes.Count == 1) { try { s.Position = 0; String type = nodes[0].Attributes["type"].Value; if (type == "FracMaster.MandelbrotFractal") { FractalForm frmchild = new FractalForm(); frmchild.MdiParent = this; frmchild.Fractal = new MandelbrotFractal(); frmchild.Fractal.ReadFromXml(s); frmchild.Show(); frmchild.Text = "Mandelbrot Fractal"; } else if (type == "FracMaster.JuliaFractal") { FractalForm frmchild = new FractalForm(); frmchild.MdiParent = this; frmchild.Fractal = new JuliaFractal(); frmchild.Fractal.ReadFromXml(s); frmchild.Show(); frmchild.Text = "Julia Fractal"; } else if (type == "FracMaster.NewtonFractal" || type == "FracMaster.NewtonFractalByIterationsRequired") { FractalForm frmchild = new FractalForm(); frmchild.MdiParent = this; frmchild.Fractal = new NewtonFractalByIterationsRequired(); frmchild.Fractal.ReadFromXml(s); frmchild.Show(); frmchild.Text = "Newton Fractal - Iterations required"; } else { // ignore } } catch { } } }