protected override void OnMouseUp(MouseEventArgs e) { base.OnMouseUp(e); this.isMouseDown = false; if (mode == 1) { int x, y, width, height; x = Math.Min(begin.X, e.X); y = Math.Min(begin.Y, e.Y); width = Math.Max(x, Math.Max(begin.X, e.X)) - x; height = Math.Max(y, Math.Max(begin.Y, e.Y)) - y; if (width < 20 || height < 20) { return; } Shape s = new Shape(new Point(x, y), width, height, color, shape); this.Controls.Add(s); s.topic.mindMap = this.mindmap; TopicControllers.UpdateTopic(s.topic); using (Graphics g = Graphics.FromImage(this.Image)) { g.FillRectangle(Brushes.White, this.ClientRectangle); } this.Invalidate(); } }
protected override void OnMouseClick(MouseEventArgs e) { if (((Draw)this.Parent).mode == 2) { ((Draw)this.Parent).current = this.topic; if (((Draw)this.Parent).first is null || ((Draw)this.Parent).first == this.topic) { ((Draw)this.Parent).first = this.topic; } else { ((Draw)this.Parent).second = this.topic; ((Draw)this.Parent).fish(((Draw)this.Parent).first, this.topic); this.topic.listTopics.Add(((Draw)this.Parent).first); TopicControllers.UpdateTopic(this.topic); ((Draw)this.Parent).second = null; ((Draw)this.Parent).first = null; } }
public void connect(TopicClass First, TopicClass Second) { first = First; second = Second; this.Image = new Bitmap(this.Parent.Width, this.Parent.Height); //Random rnd = new Random(); //Color randomColor = Color.FromArgb(rnd.Next(256), rnd.Next(256), rnd.Next(256)); p = new Pen(Color.Black, 5); this.Dock = DockStyle.Fill; gra = new GraphicsPath(); if (this.Image == null) { this.Image = new Bitmap(this.Width, this.Height); } p1 = new Point(first.X + first.Width / 2, first.Y + first.Height / 2); p4 = new Point(second.X + second.Width / 2, second.Y + second.Height / 2); p2 = new Point((p1.X + p4.X) / 2, (p1.Y + p4.Y) / 2); p3 = new Point((p1.X + p4.X) / 2, (p1.Y + p4.Y) / 2); if (p1 == p4) { this.Dispose(); return; } using (Graphics g = Graphics.FromImage(this.Image)) { g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias; g.DrawBezier(p, p1, p2, p3, p4); } first.listTopics.Add(second); second.listTopics.Add(first); TopicControllers.UpdateTopic(first); TopicControllers.UpdateTopic(second); gra.AddBezier(p1, p2, p3, p4); gra.Widen(p); this.Region = new Region(gra); this.show = false; }
private void textchanged(object sender, EventArgs e) { topic.Text = this.textBox1.Text.Trim(); TopicControllers.UpdateTopic(topic); }