예제 #1
0
        MapPictureBox AddTile(int x, int y, Bitmap b)
        {
            MapPictureBox pb = new MapPictureBox(x, y, m_allTiles.Count);

            pb.Name        = "pictureBox" + (m_allTiles.Count);
            pb.Size        = new System.Drawing.Size(b.Width, b.Height);
            pb.TabIndex    = (m_allTiles.Count);
            pb.TabStop     = false;
            pb.MouseWheel += Pb_MouseWheel;
            pb.MouseMove  += Pb_MouseMove;
            pb.Location    = new System.Drawing.Point(x * pb.Size.Width, y * pb.Size.Height);
            pb.Image       = b;
            return(pb);
        }
예제 #2
0
        private void Pb_MouseMove(object sender, MouseEventArgs e)
        {
            pbCurrent        = (MapPictureBox)sender;
            m_lastMouseTileX = e.X;
            m_currentPixelX  = pbCurrent.GetTileProp().pixelx + e.X;
            m_currentPixelY  = pbCurrent.GetTileProp().pixely + e.Y;
            pMapControlCallback(pbCurrent.tileBlock, 1, e.X, e.Y);
            if (m_missingTiles == false)
            {
                string outMessage;
                m_rightMostTile = m_allTiles.Max(n => n.Right);
                if ((this.Right - this.Left) > m_rightMostTile)
                {
                    if (AddRowTilesOnTheRight(m_allTiles[0].GetTileProp().name, out outMessage) == false)
                    {
                        m_missingTiles = true;
                        pMapMsgCallack(8912, outMessage);
                    }
                }
                m_topMostTile = m_allTiles.Min(n => n.Top);
                if (m_topMostTile > this.Top)
                {
                    if (AddRowTilesOnTheTop(m_allTiles[0].GetTileProp().name, out outMessage) == false)
                    {
                        m_missingTiles = true;
                        pMapMsgCallack(8912, outMessage);
                    }
                }
                m_bottomMostTile = m_allTiles.Max(n => n.Bottom);
                if (m_bottomMostTile < this.Bottom)
                {
                    if (AddRowTilesOnTheBottom(m_allTiles[0].GetTileProp().name, out outMessage) == false)
                    {
                        m_missingTiles = true;
                        pMapMsgCallack(8912, outMessage);
                    }
                }

                m_LeftMostTile = m_allTiles.Min(n => n.Left);
                if (m_LeftMostTile > 0)
                {
                    if (AddRowTilesOnTheLeft(m_allTiles[0].GetTileProp().name, out outMessage) == false)
                    {
                        m_missingTiles = true;
                        pMapMsgCallack(8912, outMessage);
                    }
                }
            }
        }
예제 #3
0
        private void Pb_MouseWheel(object sender, MouseEventArgs e)
        {
            MapPictureBox p = sender as MapPictureBox;

            if (ModifierKeys.HasFlag(Keys.Control))
            {
                if (e.Delta > 0)
                {
                    pMapControlZoomCallback(p.tileBlock, p.X, p.Y, true);
                }
                else
                {
                    pMapControlZoomCallback(p.tileBlock, p.X, p.Y, false);
                }
            }
        }
예제 #4
0
        MapPictureBox AddTileByLocation(int x, int y, int locx, int locy, string fileName)
        {
            int           width  = 256;
            int           height = 256;
            MapPictureBox pb     = new MapPictureBox(x, y, m_allTiles.Count);

            pb.Name          = "pictureBox" + (m_allTiles.Count);
            pb.Size          = new System.Drawing.Size(width, height);
            pb.TabIndex      = m_allTiles.Count;
            pb.TabStop       = false;
            pb.MouseWheel   += Pb_MouseWheel;
            pb.MouseMove    += Pb_MouseMove;
            pb.Location      = new System.Drawing.Point(locx, locy);
            pb.ImageLocation = fileName;
            return(pb);
        }