Esempio n. 1
0
        private void iMap_MouseMove(object sender, MouseEventArgs e)
        {
            Point        _mousePosition = e.GetPosition((Image)sender);
            SectorNumber _sector        = this.GetSectorNumberFormPoint(_mousePosition);

            if (this.FCurrentSector == null || _sector.X != this.FCurrentSector.X || _sector.Y != this.FCurrentSector.Y)
            {
                CancelHighlighting();

                if (_sector.X >= 0 && _sector.Y >= 0 && _sector.X < MapSize && _sector.Y < MapSize)
                {
                    this.FHorisontalTextBoxes[_sector.X].Foreground = this.FHighlightBrush;
                    this.FVerticalTextBoxes[_sector.Y].Foreground   = this.FHighlightBrush;
                    this.FHorisontalTextBoxes[_sector.X].FontWeight = FontWeights.ExtraBold;
                    this.FVerticalTextBoxes[_sector.Y].FontWeight   = FontWeights.ExtraBold;
                    this.FCurrentSector = _sector;

                    if (this.cMap.Children.Contains(this.FSelectionRect))
                    {
                        this.cMap.Children.Remove(this.FSelectionRect);
                    }

                    Rect _rect = new Rect(
                        (this.FCurrentSector.X + 1) * this.FCellWidth,
                        (this.FCurrentSector.Y + 1) * this.FCellHeigth,
                        this.FCellWidth, this.FCellHeigth);
                    this.FSelectionRect.Data = new RectangleGeometry(_rect);
                    this.cMap.Children.Add(this.FSelectionRect);
                }
            }
        }
Esempio n. 2
0
        private void iMap_MouseDown(object sender, MouseButtonEventArgs e)
        {
            Point _mousePosition = e.GetPosition((Image)sender);

            this.SelectedSector = GetSectorNumberFormPoint(_mousePosition);
        }