Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Moveable pic's


Wortel Angels
 Share

Recommended Posts

[![](http://www7.pic-upload.de/thumb/09.07.12/djj8gfm5v34.png)](http://www.pic-upload.de/view-15035261/Unbenannt.png.html)

Added in frm_main
```
Private Declare Function ReleaseCapture Lib "user32" () As Long

Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" _
(ByVal hWnd As Long, _
ByVal wMsg As Long, _
ByVal wParam As Long, _
lParam As Any) As Long
```
And to make the pic's moveable
```
Private Sub picCharacter_MouseDown(Button As Integer, Shift As Integer, x As Single, Y As Single)
Const WM_NCLBUTTONDOWN = &HA1
    Const HTCAPTION = 2
    If Button = 1 Then
        ReleaseCapture
        SendMessage picCharacter.hWnd, WM_NCLBUTTONDOWN, HTCAPTION, 0&
    End If

    If x > picCharacter.width - 10 Then
        If Y < -picCharacter.height + 281 Then
        picCharacter.Visible = False
        End If
    End If
End Sub
```
It works but how can i fix it that this gray thing isnt there if i move it
Link to comment
Share on other sites

Ok i got it :D
Thanks to gooby http://www.touchofdeathforums.com/smf2/index.php/topic,77908.0.html
And Wing on post #6
```

Private Sub imgCharacter_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If y < -imgCharacter.height + 281 Then
    Dragging = True
    prevX = X
    prevY = Y
    End If
End Sub
```
But its not an fix its another way to do it ;-) Lenn if you know the fix i think this is good too
Link to comment
Share on other sites

```
Static MouseX As Long, MouseY As Long

    If Button = 1 And DragBankSlotNum = 0 Then
        If Y < 22 Then

            TempX = picBank.Left + (X - MouseX)
            TempY = picBank.top + (Y - MouseY)

            If TempX < 0 Then TempX = 0
            If TempX > (picscreen.scalewidth - picBank.width) Then TempX = (800 - picBank.width)
            If TempY < 0 Then TempY = 0
            If TempY > (picscreen.scaleheight - picBank.height) Then TempY = (480 - picBank.height)

            picBank.Left = TempX
            picBank.top = TempY

        End If
    Else
        MouseX = X
        MouseY = Y
    End If
```^ Taken from picBank's mousemove sub. Another way to do it along with some code to keep it on your picscreen.

Anyway, that will always happen because we're using GDI components sliding over it, it will be there in lesser or greater extends unless you convert the menus over to full DirectDraw.
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...