Results 1 to 4 of 4

Thread: Check Drag and Drop

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Nov 2005
    Posts
    208

    Check Drag and Drop

    hi there how can i know if a nought has been dropped onto any of the 9 picture boxes. here is my code
    VB Code:
    1. Private Sub picNoughts_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles picNoughts.MouseDown
    2.  
    3.         If OX = True Then
    4.             picNoughts.DoDragDrop(picNoughts.Image, DragDropEffects.Move)
    5.             OX = False
    6.             picCrosses.Enabled = True
    7.             If pic11.Image Is picNoughts.Image And pic12.Image Is picNoughts.Image And pic13.Image Is picNoughts.Image Or _
    8.                 pic21.Image Is picNoughts.Image And pic22.Image Is picNoughts.Image And pic23.Image Is picNoughts.Image Or _
    9.                 pic31.Image Is picNoughts.Image And pic32.Image Is picNoughts.Image And pic33.Image Is picNoughts.Image Or _
    10.                 pic11.Image Is picNoughts.Image And pic21.Image Is picNoughts.Image And pic31.Image Is picNoughts.Image Or _
    11.                 pic12.Image Is picNoughts.Image And pic22.Image Is picNoughts.Image And pic32.Image Is picNoughts.Image Or _
    12.                 pic13.Image Is picNoughts.Image And pic23.Image Is picNoughts.Image And pic33.Image Is picNoughts.Image Or _
    13.                 pic13.Image Is picNoughts.Image And pic22.Image Is picNoughts.Image And pic31.Image Is picNoughts.Image Or _
    14.                 pic11.Image Is picNoughts.Image And pic22.Image Is picNoughts.Image And pic33.Image Is picNoughts.Image Then
    15.                 CalNoughts()
    16.             Else
    17.                 Drawn()
    18.             End If
    19.         End If
    20.     End Sub

  2. #2
    Hyperactive Member francisstokes's Avatar
    Join Date
    May 2005
    Location
    Kent, England
    Posts
    272

    Re: Check Drag and Drop

    When i made a O's and X's game i used nine picture boxes (box_11, box_12 et cetera). I think thats the best way to do it.

    The way your doing it, you should check where the user drops the O, and then set a boolean Variable to true accordingly. eg:

    VB Code:
    1. IsO(1,1) = true

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Nov 2005
    Posts
    208

    Re: Check Drag and Drop

    sorry i can't understand IsO(1,1) = true

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Nov 2005
    Posts
    208

    Re: Check Drag and Drop

    could somebody explain me please what is Is(1,1) mean

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width