> when i move cursor on image in one location it should display
> some information, and moving cursor in another location ,
> and need to display some other information.
> help me with visual basic 6.0 code. thanks
As other replies have indicated you can easily capture the X/Y location in the MouseMove. If that is enough for you to identify what data to show - great.
If you are looking for a way to create hotspots on an image, potentially of any shape, then you may want to look at the MetaDraw 3 OCX component. [ *Disclosure - I represent the company that created this component *]. MetaDraw is a picturebox type control you can use in VB 6 that allows you to set up multiple hotspots for any image, and assign hidden data to each hotspot. You can read this hidden data within MetaDraw events whenever the user moves into / over / out of a hotspot, or when he clicks or double clicks a hotspot. You can also tell MetaDraw to automatically change the mouse cursor when over a hotspot.
For example on an image of a map where each state is a hotspot, with hidden data for state name and population you might write:
Sub MetaDraw_OnHotSpot(ByVal X As Long, _
ByVal Y As Long, State As Integer)
Select Case State
Case EHS_ENTER
txtState.Text = MetaDraw.ObjTags("StateName")
txtPopulation.Text = MetaDraw.ObjTags("Population")
Case EHS_LEAVE
txtState.Text = ""
txtPopulation.Text = ""
End Select
End Sub
To have a seperate application, or separate mode for an application
where the user can hotspots, simply set the MetaDraw.EditMode property
to allow the user to draw shapes ( rectangles, ellipses, polygons, freehand shape, ... )
MetaDraw will automatically take care of drawing and displaying the shape.
You can then capture the Change event upon completion of each drawn shape
and get the desired data for the shape and make it a hotspot to be hidden in
View mode
Sub CmdCreateHotspot_Click()
' Allow user to draw polygon shapes
MetaDraw1.EditMode = ED_Polygon
End Sub
Sub MetaDraw1_Change(ByVal ChangeType As Integer)
With MetaDraw1
If ChangeType = CHG_OBJECTADDED Then
' - user just drew some shape
' - make it a hotspot,
' - have cursor automatically change on object,
' - and trigger event when user clicks on it
.ObjHotSpot = OS_CURSOR Or OS_CLICK Or OS_HOTSPOT
.ObjVisible = False
' - ask user to assign data for a couple of named tags
' - for this hotspot. You can use any tag names you like
.ObjTags("HotspotName") _
= InputBox("Please assign some Name for this hotspot")
.ObjTags("SomeData") _
= InputBox("Please assign some Data for this hotspot")
End If
End With
End Sub
I hope this is helpful.
For more information about MetaDraw see:
www.Bennet-Tec.com/btproducts/MetaDraw
Also here are two samples showing use of Hotspots in MetaDraw within a Web
Create Hotspots - http://www.bennet-tec.com/btproducts/MetaDraw/WebSamples/Hotspots/md3_HotspotDemo.htm
Clickable Hotspot Map - http://www.bennet-tec.com/btproducts/MetaDraw/WebSamples/MD3Map/md3_map.htm
You can see the underlying code for either of these examples by right clicking in the web page
( outside the MetaDraw control ) and selecting "View Source" .
- Jeff Bennett
Bennet-Tec Information Systems
www.Bennet-Tec.com