public void Select(object obj) { if (ObjectToDot.ContainsKey(obj) && _selectedObject != obj) { if (_selectedObject != null) { ObjectToDot[_selectedObject].SetHighlight(false); } ObjectToDot[obj].SetHighlight(true); _selectedObject = obj; } }
public void ClearElements() { SuspendDrawing(this); while (Elements.Count > 0) { this.Controls.Remove(Elements[0].PBReference); Elements[0].PBReference.Dispose(); Elements.RemoveAt(0); } ObjectToDot.Clear(); _selectedObject = null; ReDraw(); ResumeDrawing(this); }
public void AddElement(object tag, double x, double y, bool redraw = false) { PictureBox picture = new PictureBox(); picture.Image = Highland64CourseImporter.Properties.Resources.blip; picture.MouseDown += new MouseEventHandler(picture_MouseDown); picture.MouseUp += new MouseEventHandler(picture_MouseUp); picture.MouseMove += new MouseEventHandler(picture_MouseMove); SpatialObject obj = new SpatialObject(); obj.X = x; // (x - MinX) / (MaxX - MinX) * this.Width; obj.Y = y; // (y - MinY) / (MaxY - MinY) * this.Height; obj.PBReference = picture; obj.Tag = tag; Elements.Add(obj); ObjectToDot.Add(tag, obj); if (redraw) { ReDraw(); } }