public Template(FractalTemplate fractaltemplate, Panel paneltoadd, Form owner, ToolTip tooltip) : this(fractaltemplate, paneltoadd, owner) { foreach (Control control in panel.Controls) { if (control is Label) { tooltip.SetToolTip(control, ft.Name); break; } } string tooltext = null; if (ft.Fractal is IUsingComplex) { IUsingComplex complex = (IUsingComplex)ft.Fractal; tooltext = "Использует комплексное число = " + complex.GetComplex().ToString(); } if (ft.Fractal is IUsingQuaternion) { IUsingQuaternion quart = (IUsingQuaternion)ft.Fractal; if (tooltext == null) { tooltext = "Использует кватернион " + quart.Quaternion; } else { tooltext = tooltext + "\nИспользует кватернион " + quart.Quaternion; } } if (tooltext != null) { foreach (Control control in panel.Controls) { if (control is PictureBox) { tooltip.SetToolTip(control, tooltext); } } } }
{ public Template(FractalTemplate fractaltemplate, Panel paneltoadd, Form owner) { ft = fractaltemplate; panel = new Panel(); panel.Size = new Size(paneltoadd.Width - 10, 80); PictureBox pb = new PictureBox(); pb.SizeMode = PictureBoxSizeMode.AutoSize; pb.Location = new Point(3, 10); fr = ft.Fractal.GetClone(); fr.ParallelFractalCreatingFinished += (sender, fap) => { Action <Bitmap> setbit = (bit) => { pb.Image = bit; }; owner.Invoke(setbit, ft.FractalColorMode.GetDrawnBitmap(fap)); }; //if (fr.CanBack()) fr.CreateParallelFractal(60, 60, 0, 0, 60, 60); //else fr.CreateParallelFractal(60, 60); panel.Controls.Add(pb); Label namelabel = new Label(); namelabel.Size = new Size(190, namelabel.Height);; namelabel.Text = ft.Name; namelabel.Location = new Point(66, 10); if (paneltoadd.Controls.Count < 1) { panel.Location = new Point(3, 1); paneltoadd.Controls.Add(panel); } else { Control lcontrol = paneltoadd.Controls[paneltoadd.Controls.Count - 1]; panel.Location = new Point(3, lcontrol.Height + lcontrol.Location.Y + 3); paneltoadd.Controls.Add(panel); } panel.Controls.Add(namelabel); Label datalabel = new Label(); datalabel.Location = new Point(66, 45); datalabel.Text = ft.Date.ToString(); panel.Controls.Add(datalabel); panel.BorderStyle = BorderStyle.Fixed3D; panel.BackColor = Color.White; Button bt = new Button(); bt.Text = "Достать"; bt.Size = new Size(90, 30); bt.Location = new Point(panel.Width - bt.Width - 3, 10); panel.Controls.Add(bt); bt.Show(); bt.Click += (s, e) => { if (selected != null) { selected(ft); } }; bt = new Button(); bt.Size = new Size(90, 30); bt.Location = new Point(panel.Width - bt.Width - 3, 40); bt.Click += (s, e) => { if (removed != null) { removed(ft); } }; panel.Controls.Add(bt); bt.Text = "Удалить"; }