Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- Graphics g = panel1.CreateGraphics();
- Field field = new Field(g);
- field.DrawField();
- }
- }
- class Field
- {
- private char[,] Cells;
- Graphics g;
- public Field(g)
- {
- this.g = g;
- //...
- }
- public void DrawField()
- {
- for (int row = 0; row < 6; row++) {
- for (int col = 0; col < 7; col++) {
- this.DrawCell(Cells[row, col], row, col);
- }
- }
- }
- private void DrawCell(char cell, int row, int col)
- {
- g.FillRectangle(Brushes.White, x, y, cellWidth, cellHeight);
- //...
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment