I have a picture box with the following event procedure
VB Code:
'This routine is trigerred when the user click on the picture box, 'it notes the coordinates of the click Private Sub picSample_MouseDown(intButton As Integer, intShift As Integer, sngX As Single, sngY As Single) 'Add the coordinates to the list box in (x,y) format lstPositions.AddItem "(" & sngX & "," & sngY & ")" 'Take those coordinates (where user clicked) and place an 'X' picSample.CurrentX = sngX picSample.CurrentY = sngY picSample.Print "X" End Sub
Then the user can remove an entry from the listbox and then remove the X....how can I remove the X?
VB Code:
'Removes a selected item from the list box Private Sub cmdDelete_Click() Const colGrey = &H8000000F For i = 0 To (lstPositions.ListCount - 1) If (lstPositions.Selected(i) = True) Then strMid1 = Mid(lstPositions.List(i), 2, (Len(lstPositions.List(i)) - 2)) strSplit1 = Split(strMid1, ",") picSample.CurrentX = strSplit1(0) picSample.CurrentY = strSplit1(1) picSample.ForeColor = colGrey picSample.Print "X" lstPositions.RemoveItem lstPositions.ListIndex picSample.ForeColor = vbBlack End If Next i End Sub
As you can see I have found a cheap way to do it, but this marks the spot where the X was if a picture exists in the picture box




Reply With Quote