|
-
Feb 24th, 2001, 11:30 AM
#1
Thread Starter
New Member
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?
"Curiosity killed the cat, but he still has eight lives left."
- Xyanth
"The only stupid question is the question never asked."
- Xyanth
-
Feb 24th, 2001, 08:17 PM
#2
Frenzied Member
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.
Harry.
"From one thing, know ten thousand things."
-
Feb 26th, 2001, 08:25 PM
#3
Good Ol' Platypus
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
All contents of the above post that aren't somebody elses are mine, not the property of some media corporation. 
(Just a heads-up)
-
Feb 26th, 2001, 11:52 PM
#4
PowerPoster
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.
-
Mar 3rd, 2001, 10:58 PM
#5
Lively Member
What about just putting empty labels over the areas that act as buttons and then putting something in their click events.
On Error Resume Screaming...

-
Mar 3rd, 2001, 11:34 PM
#6
transcendental analytic
Harrys idea about having a bitmap with pixels indicating different click zones would apply here too, especially good for odd shaped areas.
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Mar 3rd, 2001, 11:59 PM
#7
Frenzied Member
It's just a big look up table really.
Harry.
"From one thing, know ten thousand things."
-
Mar 4th, 2001, 11:23 AM
#8
Good Ol' Platypus
What about mine? You guys (even the original poster) just completely overlooked my function. (BTW: you dont need the hWnd)
All contents of the above post that aren't somebody elses are mine, not the property of some media corporation. 
(Just a heads-up)
-
Mar 4th, 2001, 05:20 PM
#9
transcendental analytic
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
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
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
|