示例#1
0
        private void deck2PictureBox_MouseMove(object sender, MouseEventArgs e)
        {
            if (GraphicContext.GetCoorX(this, deck2PictureBox) != -1 && GraphicContext.GetCoorY(this, deck2PictureBox) != -1)
            {
                // Con trỏ di chuyển qua ô khác chưa ?
                if (GraphicContext.GetCell(GraphicContext.GetCoorX(this, deck2PictureBox)) != mouseCellX || GraphicContext.GetCell(GraphicContext.GetCoorY(this, deck2PictureBox)) != mouseCellY)
                {
                    // Đặt lại tọa độ con trỏ
                    mouseCellX = GraphicContext.GetCell(GraphicContext.GetCoorX(this, deck2PictureBox));
                    mouseCellY = GraphicContext.GetCell(GraphicContext.GetCoorY(this, deck2PictureBox));

                    deck2PictureBox.Refresh();

                    // Vẽ outline ô đã chọn
                    GraphicContext.DrawOuterFrameCell(mouseCellX, mouseCellY, 5, this, deck2PictureBox);
                }
            }
            else
            {
                // Con trỏ rời bàn cờ
                mouseCellX = 0;
                mouseCellY = 0;

                // Repaint
                deck2PictureBox.Refresh();
            }
        }
示例#2
0
        private void deck2PictureBox_Paint(object sender, PaintEventArgs e)
        {
            GraphicContext.DrawDeckStatus(player2.RevealedCells, player2.ShipSet, e);

            if (player2.LastCells[0] != -1 && player2.LastCells[1] != -1)
            {
                GraphicContext.DrawOuterFrameCell(player2.LastCells[0], player2.LastCells[1], 6, e);
            }
        }