예제 #1
0
        private void panel1_MouseClick(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Left && _isEdit)
            {
                _tempPoint.Add(e.Location);
            }
            else if (_isEdit)
            {
                _tempPoint.Add(e.Location);
                _isEdit = false;

                _roomPoints.Add(_tempPoint.ToArray());
                LoadChart(new List <Point[]>()
                {
                    _tempPoint.ToArray()
                }, new RoomEntity {
                    Number = new Random().Next(100).ToString("1000")
                });
                panelRight.Refresh();
            }

            if (!_isEdit)
            {
                foreach (var item in _roomControls)
                {
                    var room = item as VectorRoomControl;
                    room.Selected = PointInFences(e.Location, room.Points);
                    if (room.Selected)
                    {
                        this._selctedRoom = room;
                    }
                }
                panelRight.Refresh();
            }
        }
예제 #2
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            if (_selctedRoom == null)
            {
                return;
            }

            _roomControls.Remove(_selctedRoom);
            _selctedRoom = null;
            panelRight.Refresh();
        }