OK, got it now.
I donno what you wanna do exactly with that two last lines in the code (regions), but my best guess is you are trying to keep track drawn rectangle cause they disappear when a new one is created, is it true?
well, if it is, thats a bad idea. lets get to buissiness, less talking.
I've uploaded the code for you :
http://rapidshare.com/files/332318003/PaintLikeApp.rar[
^]
in this sample, you can load a pic ( or dont ) and draw some blue rectangle on it ( by draging left mouse button ), and see the color of selected pixel by right mouse button.
enjoy.
--------------------
Regards
H.Maadani