public void load(string ID) { this.Controls.Clear(); { using (var _context = new DBTopicContext()) { if (ID == null) { return; } int idd = Int32.Parse(ID); this.mindmap = MindMapControllers.LoadMindMap(idd); foreach (var t in mindmap.listTopics) { var first = TopicControllers.GetTopic(t.ID); foreach (var second in first.listTopics) { this.fish(first, second); } } foreach (var t in mindmap.listTopics) { Shape s = new Shape(t); this.Controls.Add(s); s.BringToFront(); } } } }
private void btnClear_Click(object sender, EventArgs e) { hideSubMenu(); this.draw1.Controls.Clear(); using (Graphics g = Graphics.FromImage(this.draw1.Image)) { g.FillRectangle(Brushes.White, this.ClientRectangle); } this.draw1.mindmap = new Models.MindMapClass(); this.draw1.mindmap.ID = MindMapControllers.GetIDfromDB(); MindMapControllers.AddMindMap(draw1.mindmap); }
public Form1() { InitializeComponent(); customxizeDesing(); DoubleBuffered = true; SetStyle(ControlStyles.OptimizedDoubleBuffer, true); this.draw1.tb = new TextBox(); this.draw1.mindmap = new Models.MindMapClass(); this.draw1.Controls.Add(this.draw1.tb); this.draw1.tb.Multiline = true; this.draw1.tb.WordWrap = true; this.draw1.tb.Visible = false; this.draw1.BackColor = Color.White; draw1.tb.TextChanged += tb_TextChanged; draw1.mindmap.ID = MindMapControllers.GetIDfromDB(); MindMapControllers.AddMindMap(draw1.mindmap); }
public FormLoad() { int temp = 0; InitializeComponent(); this.tableLayoutPanel1.ColumnStyles.Clear(); this.tableLayoutPanel1.RowStyles.Clear(); foreach (MindMapClass mm in MindMapControllers.LoadAllMindMap()) { if (mm.listTopics.Count == 0) { continue; } TopicLoad b = new TopicLoad(mm); b.Click += piclick; this.tableLayoutPanel1.Controls.Add(b, 0, temp++); } }
public void save() { if (mindmap == null) { mindmap = new MindMapClass(); mindmap.ID = MindMapControllers.GetIDfromDB(); } mindmap.listTopics.Clear(); if (this.Image == null) { this.Image = new Bitmap(this.Width, this.Height); this.BackColor = Color.White; } try { using (Graphics g = Graphics.FromImage(this.Image)) { g.FillRectangle(Brushes.White, this.ClientRectangle); this.BackColor = Color.White; foreach (Control c in this.Controls) { if (c == this.tb) { continue; } if (c is Connect) { g.DrawBezier(((Connect)c).p, ((Connect)c).p1, ((Connect)c).p2, ((Connect)c).p3, ((Connect)c).p4); continue; } } foreach (Control c in this.Controls) { if (c is Shape) { g.DrawImage(((Shape)c).save(), c.Location); mindmap.listTopics.Add(((Shape)c).topic); } } } { SaveFileDialog sfd = new SaveFileDialog(); sfd.FileName = "Images|*.png; *.bmp"; ImageFormat format = ImageFormat.Png; if (sfd.ShowDialog() == System.Windows.Forms.DialogResult.OK) { string ext = System.IO.Path.GetExtension(sfd.FileName); switch (ext) { case ".jpg": format = ImageFormat.Jpeg; break; case ".bmp": format = ImageFormat.Bmp; break; } } this.Image.Save(sfd.FileName, format); mindmap.name = sfd.FileName; MindMapControllers.UpdateMindMap(mindmap); using (Graphics g = Graphics.FromImage(this.Image)) { g.FillRectangle(Brushes.White, this.ClientRectangle); } } } catch { } }