Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace DrawingTest
- {
- using System;
- using System.Drawing;
- using System.Windows.Forms;
- public partial class Form1 : Form
- {
- private const int SIZE = 100;
- private const int TILE_COUNT = 4;
- public Form1()
- {
- InitializeComponent();
- ClientSize = new Size
- {
- Height = SIZE * TILE_COUNT,
- Width = SIZE * TILE_COUNT
- };
- //Paint += Form1_Paint;
- }
- //private void Form1_Paint(object sender, PaintEventArgs e)
- //{
- // Graphics g = e.Graphics;
- // for (int i = 0; i < TILE_COUNT; ++i)
- // {
- // for (int j = 0; j < TILE_COUNT; ++j)
- // {
- // g.FillRectangle(new SolidBrush(Color.AliceBlue), new Rectangle
- // {
- // Height = SIZE,
- // Width = SIZE,
- // X = j * SIZE,
- // Y = i * SIZE
- // });
- // g.DrawRectangle(new Pen(Color.Black), new Rectangle
- // {
- // Height = SIZE,
- // Width = SIZE,
- // X = j * SIZE,
- // Y = i * SIZE
- // });
- // }
- // }
- //}
- protected override void OnClick(EventArgs e)
- {
- Graphics g = CreateGraphics();
- for (int i = 0; i < TILE_COUNT; ++i)
- {
- for (int j = 0; j < TILE_COUNT; ++j)
- {
- g.FillRectangle(new SolidBrush(Color.AliceBlue), new Rectangle
- {
- Height = SIZE,
- Width = SIZE,
- X = j * SIZE,
- Y = i * SIZE
- });
- g.DrawRectangle(new Pen(Color.Black), new Rectangle
- {
- Height = SIZE,
- Width = SIZE,
- X = j * SIZE,
- Y = i * SIZE
- });
- }
- }
- }
- protected override void OnPaint(PaintEventArgs e)
- {
- //Graphics g = e.Graphics;
- //for (int i = 0; i < TILE_COUNT; ++i)
- //{
- // for (int j = 0; j < TILE_COUNT; ++j)
- // {
- // g.FillRectangle(new SolidBrush(Color.AliceBlue), new Rectangle
- // {
- // Height = SIZE,
- // Width = SIZE,
- // X = j * SIZE,
- // Y = i * SIZE
- // });
- // g.DrawRectangle(new Pen(Color.Black), new Rectangle
- // {
- // Height = SIZE,
- // Width = SIZE,
- // X = j * SIZE,
- // Y = i * SIZE
- // });
- // }
- //}
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment