Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Feature] Moveable PictureBoxes
#1
Difficulty: 1/5 - Very easy to add/use.
Functionality: Made for MS4.


My first tutorial, not a bad one at that either, thanks to DFA.

-- CLIENT --

First, open up frmMirage & for the PictureBox you want to be Moveable, edit the following, then add it in:

Code:
Private Sub picMapEditor_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    SOffsetX = X
    SOffsetY = Y
End Sub

Private Sub picMapEditor_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    Call MovePicture(frmMirage.picMapEditor, Button, Shift, X, Y)
End Sub

Then move onto modDatabase, & add the following below "Option Explicit":

Code:
Public SOffsetX As Integer
Public SOffsetY As Integer

Sub MovePicture(PB As PictureBox, Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim GlobalX As Integer
Dim GlobalY As Integer

GlobalX = PB.Left
GlobalY = PB.Top

If Button = 1 Then
    PB.Left = GlobalX + X - SOffsetX
    PB.Top = GlobalY + Y - SOffsetY
End If
End Sub

Enjoy! Post what'cha think.

P.S. For every Moveable PictureBox you want, you have to copy/paste & edit the frmMirage stuff.
Reply
#2
Actualy, that all wasn't enough for me, I had to add:

Code:
Private Sub picMapEditor_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
    Call MovePicture(frmMirage.picMapEditor, Button, Shift, x, y)
End Sub

Aye, if I wanted smooth moving (without auto-move cursor to left upper corner of image and changing position of image instantly when click). So, all you have to add is calling "MovePicture" on MouseMove in picture box.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)