Print Page | Close Window

Moveable Pictureboxes

Printed From: Mirage Source
Category: Tutorials
Forum Name: Approved Tutorials
Forum Discription: All tutorials shown to actually work with MSE are moved here.
URL: http://ms.shannaracorp.com/backup-forums/forum_posts.asp?TID=27
Printed Date: 20 December 2006 at 6:01pm
Software Version: Web Wiz Forums 8.01 - http://www.webwizforums.com


Topic: Moveable Pictureboxes
Posted By: Sync
Subject: Moveable Pictureboxes
Date Posted: 07 February 2006 at 5:13pm
Originally posted by jokeofweek

[glow=red,2,300]Movable Picture Boxes :-P[/glow]
---
Difficulty : Easy 1 / 5

Many people have wondered how to do this, and I was one of those people. I was bored today and decided to explore , so I put a bit of code here and there, and I got the code to movable picture boxes :D!

Firstly, put the following code in your [Declarations]:

Public mouseX As Integer
Public mouseY As Integer


Now, in the Form section, go to sub Form_Dragdrop and put the following code :

Private Sub Form_DragDrop(Source As Control,X as single, Y As Single)
picturename.Move X - mouseX, Y - mouseY
End Sub


Now change picturename to the name of your picbox ;)

Now lastly, in the subs for your picbox, go to the MouseDown one and put this code:

Private Sub picturename_MouseDown(Button As Integer,Shift As Integer, X As Single, Y As Single)
picturename.Drag vbBeginDrag
mouseX = X
mouseY = Y
End Sub


There you go :) You can now move your picture box ;) Enjoy  :lol:

*BUG FIX* I edited abit of the code for spelling mistakes ;)



Replies:
Posted By: Sync
Date Posted: 07 February 2006 at 5:14pm
Originally posted by Minatours

To make it c ome to the top just change the ZOrder. just add this bit of code to the picturebox when it is clicked.


Private Sub Picture1_Click()
Picture1.ZOrder (0)
End Sub


Just change picture1 to the name of your picturebox.

Mina



Posted By: Sync
Date Posted: 07 February 2006 at 5:14pm
Approved




Print Page | Close Window

Bulletin Board Software by Web Wiz Forums version 8.01 - http://www.webwizforums.com
Copyright ©2001-2006 Web Wiz Guide - http://www.webwizguide.info