Solved

Line follow mouse pointer

Posted on 2000-03-12
1
215 Views
Last Modified: 2010-05-02
How do I create a line (vertical) that follow the mouse over my form in a specific area? I also want it to run a function when it (the mouse) changes coordinates to update some text in the form.

Thanks!
0
Comment
Question by:bert1
1 Comment
 
LVL 1

Accepted Solution

by:
vsankarv earned 50 total points
ID: 2609481
Dim ht, wt As Integer

Private Sub Form_Load()
ht = Abs(Line1.Y1 - Line1.Y2)
wt = Abs(Line1.X1 - Line1.X2)
End Sub

Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Line1.X1 = X
Line1.Y1 = Y
Line1.X2 = Line1.X1 + wt
Line1.Y2 = Line1.Y1 + ht
'call your function here
End Sub
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

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 …
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

746 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now