Owner Draw in VB (Matt Gertz)

I hate going so long without blogging, but it’s getting really busy around here as we get closer to the endgame for Visual Studio 2008.  That, combined with “review time,” creates a bit of a problem for writing apps for the blog, and I wasn’t able to give it much attention until last night.  Realizing I really needed to get an article out, I was wracking my brains for something to write about. 

I happened to notice that my wife was working on some puzzles in her “Games” magazine – she was on one of her favorites, which is called Paint-by-Numbers.   I thought that it might be cool to write her a small app in which I could generate some of those puzzles for her so she wouldn’t have to wait until the next issue arrived.  Then I realized, “Ah, what a perfect blog topic!  There are so many things I could cover in such an app that I haven’t covered before.”  So, here goes – I’ll be writing up this app over the next couple of weeks (posting the final product at the end of the series), and will document the approach for the following topics:

·         Owner draw and coordinate mapping on events (shown in this blog post)

·         Supporting undo/redo using a double list of action classes, leveraging generics for this.

·         Loading  & Saving puzzles

·         Printing the puzzle and the solution

Paint-by-Numbers background

Paint-by-numbers is a puzzle wherein you’re given a grid, and on the outside of the grid you’re given clues about which parts of the grid should be filled in.  For example, here’s a simple 8×8 PBN puzzle which has been solved already:

 

5

1

1

1

5

 

8

1

1

1

2

2

1 1 2

 

 

 

 

 

 

 

 

 

1 1 1 1

 

 

 

 

 

 

 

 

 

1 1 1 1