private void PMouseUp(object sender, MouseEventArgs e) { switch (e.Button) { case MouseButtons.Left: if (_movingObject != null) { if (_movingObject.x < 0 || _movingObject.x > _pnlPlan.Width || _movingObject.y < 0 || _movingObject.y > _pnlPlan.Height) { _floorPlanEntries.RemoveAll(p => p.id == _movingObject.id && p.type == _movingObject.type); Fpc.Fpobject.objects.@object = _floorPlanEntries.ToArray(); _pnlPlan.Invalidate(); ShowObjects(); } } _movingObject = null; Fpc.NeedsRefresh = true; break; } }
private void PnlPlanDragDrop(object sender, DragEventArgs e) { if (e.Data.GetDataPresent(typeof(ListItem))) { Point local = _pnlPlan.PointToClient(new Point(e.X, e.Y)); int x = local.X - 16; int y = local.Y - 16; var li = ((ListItem)e.Data.GetData(typeof(ListItem))); var fpobj = new objectsFloorplanObjectsEntry { type = li.Type, id = li.Id, x = x, y = y, angle = 135, fov = 120, radius = 80 }; _floorPlanEntries.Add(fpobj); Fpc.Fpobject.objects.@object = _floorPlanEntries.ToArray(); _pnlPlan.Invalidate(); ShowObjects(); } Fpc.NeedsRefresh = true; }
private void PMouseDown(object sender, MouseEventArgs e) { switch (e.Button) { case MouseButtons.Left: bool handled = false; if ((ModifierKeys & Keys.Shift) == Keys.Shift) { handled = true; _anglingObject = null; foreach (objectsFloorplanObjectsEntry fpoe in Fpc.Fpobject.objects.@object) { if ((fpoe.x - 22) <= e.X && (fpoe.x + 22) > e.X && (fpoe.y - 22) <= e.Y && (fpoe.y + 22) > e.Y) { _anglingObject = fpoe; break; } } //Console.WriteLine("set angling object to "+_anglingObject.type+":"+_anglingObject.id); } if ((ModifierKeys & Keys.Alt) == Keys.Alt) { handled = true; _fovingObject = null; foreach (objectsFloorplanObjectsEntry fpoe in Fpc.Fpobject.objects.@object) { if ((fpoe.x - 44) <= e.X && (fpoe.x + 44) > e.X && (fpoe.y - 44) <= e.Y && (fpoe.y + 44) > e.Y) { _fovingObject = fpoe; break; } } //Console.WriteLine("set angling object to "+_anglingObject.type+":"+_anglingObject.id); } if ((ModifierKeys & Keys.Control) == Keys.Control) { handled = true; _radialObject = null; foreach (objectsFloorplanObjectsEntry fpoe in Fpc.Fpobject.objects.@object) { if ((fpoe.x - 44) <= e.X && (fpoe.x + 44) > e.X && (fpoe.y - 44) <= e.Y && (fpoe.y + 44) > e.Y) { _radialObject = fpoe; break; } } //Console.WriteLine("set angling object to "+_anglingObject.type+":"+_anglingObject.id); } if (!handled) { _movingObject = null; foreach (objectsFloorplanObjectsEntry fpoe in Fpc.Fpobject.objects.@object) { if ((fpoe.x - 22) <= e.X && (fpoe.x + 22) > e.X && (fpoe.y - 22) <= e.Y && (fpoe.y + 22) > e.Y) { _movingObject = fpoe; break; } } } break; } }
private void PnlPlanDragDrop(object sender, DragEventArgs e) { if (e.Data.GetDataPresent(typeof (ListItem))) { Point local = _pnlPlan.PointToClient(new Point(e.X, e.Y)); int x = local.X - 16; int y = local.Y - 16; var li = ((ListItem) e.Data.GetData(typeof (ListItem))); var fpobj = new objectsFloorplanObjectsEntry {type = li.Type, id = li.Id, x = x, y = y, angle = 135, fov = 120, radius=80}; _floorPlanEntries.Add(fpobj); Fpc.Fpobject.objects.@object = _floorPlanEntries.ToArray(); _pnlPlan.Invalidate(); ShowObjects(); } Fpc.NeedsRefresh = true; }
private void PMouseUp(object sender, MouseEventArgs e) { switch (e.Button) { case MouseButtons.Left: if (_movingObject!=null) { if (_movingObject.x<0 || _movingObject.x>_pnlPlan.Width || _movingObject.y<0 || _movingObject.y>_pnlPlan.Height) { _floorPlanEntries.RemoveAll(p => p.id == _movingObject.id && p.type == _movingObject.type); Fpc.Fpobject.objects.@object = _floorPlanEntries.ToArray(); _pnlPlan.Invalidate(); ShowObjects(); } } _movingObject = null; Fpc.NeedsRefresh = true; break; } }
private void PMouseDown(object sender, MouseEventArgs e) { switch (e.Button) { case MouseButtons.Left: bool handled = false; if ((ModifierKeys & Keys.Shift) == Keys.Shift) { handled = true; _anglingObject = null; foreach (objectsFloorplanObjectsEntry fpoe in Fpc.Fpobject.objects.@object) { if ((fpoe.x - 22) <= e.X && (fpoe.x + 22) > e.X && (fpoe.y - 22) <= e.Y && (fpoe.y + 22) > e.Y) { _anglingObject = fpoe; break; } } } if ((ModifierKeys & Keys.Alt) == Keys.Alt) { handled = true; _fovingObject = null; foreach (objectsFloorplanObjectsEntry fpoe in Fpc.Fpobject.objects.@object) { if ((fpoe.x - 44) <= e.X && (fpoe.x + 44) > e.X && (fpoe.y - 44) <= e.Y && (fpoe.y + 44) > e.Y) { _fovingObject = fpoe; break; } } } if ((ModifierKeys & Keys.Control) == Keys.Control) { handled = true; _radialObject = null; foreach (objectsFloorplanObjectsEntry fpoe in Fpc.Fpobject.objects.@object) { if ((fpoe.x - 44) <= e.X && (fpoe.x + 44) > e.X && (fpoe.y - 44) <= e.Y && (fpoe.y + 44) > e.Y) { _radialObject = fpoe; break; } } } if (!handled) { _movingObject = null; foreach (objectsFloorplanObjectsEntry fpoe in Fpc.Fpobject.objects.@object) { if ((fpoe.x - 22) <= e.X && (fpoe.x + 22) > e.X && (fpoe.y - 22) <= e.Y && (fpoe.y + 22) > e.Y) { _movingObject = fpoe; break; } } } break; } }