|
-
Apr 29th, 2001, 11:31 AM
#1
Thread Starter
Member
Color inside lines
I have loaded a black and white picture into a picture box control. This will be used like a coloring book. What i would like to do is keep the user inside the region of the picture box that they clicked in and held the mouse down to color. Example you have 4 balloons that are in seperate parts of the picturebox, only allow the user to stay in the balloon the started to hold the mouse down in. I occasionally get the mousemove funcion to get the pixel of the x,y positions, but most of the time the mousemove doesn't retreive the pixel in time. Anyone point me in the right direction would be apreciated. PS the floodfill part works and i would like to do the same thing only let the child color it in.
Thanks Steve
-
Apr 30th, 2001, 02:25 PM
#2
Errr.. What about this?
Use the decleration;
Public Declare Function GetPixel Lib "gdi32" Alias "GetPixel" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long) As Long
Then setup some loops so it moves right across the picture till it finds a change in picture colour i.e. returned value changes. Then it moves left from that point, then up one line and then repeats this down one line.
p.s. if the colour is the same it changes the colour to the colour you want it to be using;
Public Declare Function SetPixelV Lib "gdi32" Alias "SetPixelV" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal crColor As Long) As Long
Sorry if that was hard to understand! My english isnt great, i know.
-
Apr 30th, 2001, 03:48 PM
#3
Thread Starter
Member
Tried that
I have tried getpixel (in the mousemove_event) and it doesn't alway catch that the mouse has gone out of the white to the black. I'll keep digging if any other ideas
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|