public void drawMatrix(Graphics g) { for (int i = 0; i < rows; i++) { for (int j = 0; j < columns; j++) { matrix.ElementAt(i).ElementAt(j).drawSquare(g); } } if (selectedSquare != null) { selectedSquare.drawSquare(g); } }
private void Form1_Paint(object sender, PaintEventArgs e) { s1.drawSquare(e.Graphics); s2.drawSquare(e.Graphics); s3.drawSquare(e.Graphics); s4.drawSquare(e.Graphics); e.Graphics.DrawImage(mainBitmap, 0, 0); if (play) { e.Graphics.DrawImage(playHoverBtmp, 140, 250); } else { e.Graphics.DrawImage(playBitmap, 140, 250); } if (highScores) { e.Graphics.DrawImage(scoresHoverBtmp, 140, 295); } else { e.Graphics.DrawImage(highScoreBitmap, 140, 295); } if (help) { e.Graphics.DrawImage(helpHoverBtmp, 140, 340); } else { e.Graphics.DrawImage(helpBitmap, 140, 340); } if (exit) { e.Graphics.DrawImage(exitHoverBtmp, 140, 385); } else { e.Graphics.DrawImage(exitBitmap, 140, 385); } }
private void Play_Paint(object sender, PaintEventArgs e) { e.Graphics.Clear(Color.Black); sMatrix.drawMatrix(e.Graphics); if (comboScore) { e.Graphics.DrawString(Score + sMatrix.score.ToString() + " +" + sMatrix.getComboScore.ToString(), font.getFont(), new SolidBrush(Color.Beige), offset, 10 + rows * squareWidth); } else { e.Graphics.DrawString(Score + sMatrix.score.ToString(), font.getFont(), new SolidBrush(Color.Beige), offset, 10 + rows * squareWidth); } e.Graphics.DrawString(Time + time.ToString(), font.getFont(), new SolidBrush(Color.Beige), this.Width - 152, 10 + rows * squareWidth); e.Graphics.DrawString(Combo + sMatrix.combo.ToString(), font.getFont(), new SolidBrush(Color.Beige), offset, 40 + rows * squareWidth); e.Graphics.DrawString(Squares + sMatrix.numberOfSquares.ToString(), font.getFont(), new SolidBrush(Color.Beige), this.Width - 215, 40 + rows * squareWidth); e.Graphics.DrawString(Weapons, font.getFont(), new SolidBrush(Color.Beige), offset, 75 + rows * squareWidth); bomb.drawSquare(e.Graphics); cut.drawSquare(e.Graphics); freeze.drawSquare(e.Graphics); mute.drawSquare(e.Graphics); }