Sorry for the double post, however, I have a question about how to get this to work.
Here is the problem, the sub works ALMOST correctly. It see's the items as the first pixels in the upper lefthand part of the picVisInv, not the actual blting of the item.
I tried messing with the InvPosX, InvPosY, X, Y, and I still can't seem to get it to move off of those pixels. Can anyone help me out with this? I have the standard 32 * 32 pixel items, and a 5 pixel offset between the top and sides of the picVisInv, and 5 pixel offset between the item pics. I know that I need to add in the offset, and the 32 * 32 pixels for the pics so the picItemDesc shows up when actually on the pictue. I wouldn't be too worried about this, I might take it out, however the other subs to drop and use the items are based on this, so scrolling over the actual item and double-clicking etc. does nothing.
SPOILER: (click to show)
Code:
Private Sub picVisInv_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim i As Long
Dim InvNum As Long
Dim ItemNum As Long
InvPosX = X
InvPosY = Y
InvNum = IsItem(X, Y)
If InvNum <> 0 Then
ItemNum = GetPlayerInvItemNum(MyIndex, InvNum)
lblItemName.Caption = Trim$(Item(ItemNum).Name)
picItemDesc.Visible = True
Exit Sub
Else
lblItemName.Caption = ""
End If
End Sub
Edit: I've been thinking a little more into this, and I still do not know what to do to fix this, however I believe that what I need to change is not in the above sub, it's in the IsItem Function. I'm using the default IsItem Function (with only a change of the 4 - 8, just changing the amount of columns of items in the visual inventory. I posted the code below, for anyone to lazy to go look at it above, or who wants a look at my specific code.
SPOILER: (click to show)
Code:
Private Function IsItem(ByVal X As Single, ByVal Y As Single) As Long
Dim tempRec As RECT
Dim i As Long
For i = 1 To MAX_INV
If GetPlayerInvItemNum(MyIndex, i) > 0 And GetPlayerInvItemNum(MyIndex, i) <= MAX_ITEMS Then
With tempRec
.Top = InvY + ((InvOffsetY + 32) * ((i - 1) \ 8))
.Bottom = .Top + PIC_Y
.Left = InvX + ((InvOffsetX + 32) * (((i - 1) Mod 8)))
.Right = .Left + PIC_X
End With
If X >= tempRec.Left And X <= tempRec.Right Then
If Y >= tempRec.Top And Y <= tempRec.Bottom Then
IsItem = i
Exit Function
End If
End If
End If
Next i
IsItem = 0
End Function