Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Proper Drag-able Boxes
#1
Author: pingu
Difficulty: 1/5

:: CLIENT SIDE ::
In modDatabase, after "Option Explicit" add:
Code:
Public SOffsetX As Integer
Public SOffsetY As Integer

At the bottom of modDatabase, add:
Code:
Sub MovePicture(PB As PictureBox, Button As Integer, Shift As Integer, x As Single, y As Single)
    If Button = 1 Then
        PB.Left = PB.Left + x - SOffsetX
        PB.top = PB.top + y - SOffsetY
    End If
End Sub

Okay, thats all for that portion. Now, let's say we want to make the map editor drag-able. First, add a private sub for the mapeditor pic with mousedown and mousemove:
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
You can do the same thing with other things, too. =) Just follow with the above code.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)