I have created a label on a form, to imitate a hyperlink on browser, such that when it detects mouse movement over the label, it changes color and changed back to the original color when mouse moves out of the control, and opens the browser upon left click.
I have no problem detecting mouse movement when it's over the label. But how do I detect the mouse has left the label? Is it possible not to use API?
to do that, one uses the SetCapture and ReleaseCapture API calls (that i know of).
The problem is that the SetCapture call requires a hWnd, which the label doesn't have. if u can think of some other control that does have a hWnd then:
VB Code:
Static CtrMov As Boolean
With objControl
If (X < 0) Or (Y < 0) Or (X > .Width) Or (Y > .Height) Then
The Drag-Drop method doesn't work because it doesn't capture the mouse button event, which I need to fire up some application upon clicking of a mouse button.
So I had to use the ReleaseCapture and SetCapture APIs. I used Picutre Box control to display the text. The result is exactly how I wanted. FYI, the TextBox control didn't work as well since a cursor is set in the control when mouse is clicked or got the focus.