-
Hey hey! Need help here. ;) I'm trying to discover the way to select a specific section of a bitmap in my program to work as a button. What I really want is One large bitmap with different items on it, and have my program select the specific item off of the one bitmap for different buttons on the form. MyCaster does this, as well as NeoPlanet, and WinAmp too, I think.
Any sujeschuns?
-
You could use GetCursorPos, and some other API stuff to do with this kinda thing like GetWindowRect (I think that's what it's called), GetPointInRect, etc.
-
Use GETCURSORPOS
and use the hWnd of the bitmap
and store data in a RECT of where you want it to be:
Function MiR(Rcte as RECT, hWnd as Long) as Boolean
Dim A as PointAPI
A = GetCursorPos
If A.X > rcte.left-1 and a.x < rcte.right+1 then
If A.Y > rcte.top-1 and a.y < rcte.bottom+1 then
MiR = True
End If
End If
End Function
-
You can make the big picture in the background, then put smaller images around each of the items you want to be buttons. Then in the smaller image clicks, do your code.
-
What about just putting empty labels over the areas that act as buttons and then putting something in their click events.
-
Harrys idea about having a bitmap with pixels indicating different click zones would apply here too, especially good for odd shaped areas.
-
It's just a big look up table really.
-
What about mine? You guys (even the original poster) just completely overlooked my function. (BTW: you dont need the hWnd)
-
probably the best for the simplest purposes
MiR=A.X >= rcte.left and a.x <= rcte.right and A.Y >= rcte.top and a.y <= rcte.bottom
would be simpler though