Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > Beginning VB 6
|
Beginning VB 6 For coders who are new to Visual Basic, working in VB version 6 (not .NET).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning VB 6 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 10th, 2005, 08:16 AM
Registered User
 
Join Date: Oct 2005
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Apocalypse
Default A Picture to follow the mouse move

Dear Helpers,

I took a VB Course, but since school started, i haven't practiced because of all the school work, and now i regretfully almost forgot many things about VB. Thats why i baught the book "VBScript" hoping it will be a good reference.

Anyways, my question is, On Activex Document EXE, im trying to make a picture follow the mouse pointer on the form. I've tried some ways insuccessfully, can some one please show me a way?

Apocalyptic Regards,
 
Old November 10th, 2005, 02:28 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 627
Thanks: 0
Thanked 0 Times in 0 Posts
Default

why don't you show us the code you wrote so far? This is the standard way to do when asking help for school homework.
Marco
 
Old November 10th, 2005, 02:35 PM
Registered User
 
Join Date: Oct 2005
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Apocalypse
Default

I didnt save the work i did, but i was working under the:

Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)

Then I tried some things that I knew wouldnt work:(

Need more info??? I need this solution Soon, thanx

Apocalyptic Regards,
 
Old November 10th, 2005, 04:03 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 627
Thanks: 0
Thanked 0 Times in 0 Posts
Default

so you meant the dog ate the homework, right? :-)

Anyway, you need to show an image in the form, so you loaded an image using a Image or PictureBox control, right?
Now, you want to "click" on the image and "move" it around with the mouse (like dragging)? Or do you want the image to always follow the mouse when the mouse in the form? They are two different problems

Marco
 
Old November 10th, 2005, 04:15 PM
Registered User
 
Join Date: Oct 2005
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Apocalypse
Default

No, i didnt work hard on the Homework... Ill work harder next time.

So, i have a picture in a PictureBox called Image1, I managed dragging the picture, and stating where its moving in a textbox, using this:

Private Sub Command1_DragOver(Source As Control, X As Single, Y As Single, State As Integer)
Dim a As String
a = "Now Dragging"
a = a + Source.Tag
a = a + "Over the open button"
a = a + "State="
a = a + Str(State)
Text1.Text = a
'"Now dragging over the button"
End Sub

Private Sub Form_DragDrop(Source As Control, X As Single, Y As Single)
Text1.Text = ""
Source.Move X, Y
End Sub

Private Sub Form_DragOver(Source As Control, X As Single, Y As Single, State As Integer)
Dim a As String
'a = "Now Dragging"
'a = a + Source.Tag
'a = a + "Over the form"
'a = a + "state="
'a = a + Str(State)
Text1.Text = "Now dragging over the form"
End Sub

(It was almost trial and error).

Anyways, i want the picture to follow the mouse pointer on form load, as soon as the mouse pointer moves, no clicking.

If you can, dont tell me the answer at once, give me some clues, ill try to remember something... i hope i do :)

I forgot to ask you, so do you think "VBScript" will help me with my condition?

Apocalyptic Regards,
 
Old November 10th, 2005, 06:01 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 627
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Sorry, I don't know the book you mentioned.

From what you described, it looks like you want a custom mouse cursor. Did you look at the MousePointer and MouseIcon properties?

Marco
 
Old November 11th, 2005, 02:41 AM
Registered User
 
Join Date: Oct 2005
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Apocalypse
Default

Oh... that should do it, it worked with me, but what i actually wanted was a small picture to follow a normal mouse pointer around the form. But its OK, thanks sir for the help.

Apocalyptic Regards,





Similar Threads
Thread Thread Starter Forum Replies Last Post
How to move the mouse in VC++ 2005 marcelo39 Visual C++ 0 April 25th, 2008 09:36 AM
track mouse position while it's held down and move lina10 VBScript 0 April 9th, 2007 12:50 AM
Word-unable to move cursor using mouse. jahid General .NET 0 February 6th, 2007 06:10 AM
glowing the lable while mouse move anukagni Access 3 July 27th, 2006 12:47 AM
Is it possible to move the mouse? nerssi Javascript 2 September 2nd, 2005 07:41 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.