Solved

mouse move on shape

Posted on 2007-11-29
3
159 Views
Last Modified: 2013-12-25
have a shape1 on form.
is possible to use a mouse move event or other controll, and when the cursor go on shape1, show tootltip "this is the shape1"

in effect i intercept position of this shape1 with the code above and when the cursor go in this coordinate show the tooltip "this is the sahpe1"

part of code
Private Sub Image1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)

    lDC = GetWindowDC(0)
    Call GetCursorPos(tPOS)
    lColor = GetPixel(lDC, tPOS.X, tPOS.Y)

If tPOS.X >= 440 And tPOS.X <= 460 And tPOS.Y >= 340 And tPOS.Y <= 360 Then
'"show the tooltip when the mouse go here"      
        Me.Label5.Caption = "CAMPANIA": Exit Sub
    Else
        Me.Label5.Caption = ""
    End If
0
Comment
Question by:sal21
  • 3
3 Comments
 
LVL 23

Accepted Solution

by:
ahammar earned 500 total points
ID: 20380296
Put an image box the same size as your shape on top of (or under) the shape.  Do not put a picture in it.  Do not change any of the properties except for the tool tip.  Set it to be whatever you want it to be.  When you open your form, you will not be able to see the image box, but it will be there, and the tool tip will still show up when you put your mouse over the shape as long as the image box is the same size and shape as our shape, and directly over or under it...

:-)
Albert
0
 
LVL 23

Expert Comment

by:ahammar
ID: 20380305
Also...you can put code in the image box click event (or whatever other events you want) and when you click on the shape, the image box code will run.  It will look like you are clicking on the shape, but you will really be clicking on the image box that you can't see.

ps...make sure you do not change the visible property to false...leave it as true.  You still will not be able to see it if you don't put a picture in it...

:-)
Albert


0
 
LVL 23

Expert Comment

by:ahammar
ID: 20380322
Actually, you can use a label or any other control that you can remove all text and set to transparent.  It does not have to be an Image box control.  As long as you leave the visible property set to true, you can make it transparent, you still will not be able to see it, but all code events will still work, just as if you could see it...it will appear as if you are acting on the shape, but you will really be acting on the transparent control...


:-)
Albert
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

778 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question