Creating a custom control in winforms - Part 6: Testing!

Continuing on from last time...

Now that we've got Painting, Mouse handling up to speed, it's time to build a test application.

After adding a Square to your control, add these few lines in OnLoad (or after initialize component)

PropertyGrid pg = new PropertyGrid();
this.Controls.Add(pg);
pg.Dock = DockStyle.Left;
pg.SelectedObject = square1;

Now when you run the application, you've got a property grid right on your form to test out all the properties.

Checking the size property, we see that changing either the size or the width can make the square, well, not very squarelike. We'll tackle this next time when we talk about SetBoundsCore.