Results 1 to 6 of 6

Thread: picture box help

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Nov 2002
    Posts
    21

    picture box help

    Hello Everyone,

    Simply question for some of you to answer (by just looking at some of the posts). I have a database that searches traverses through loading images into image boxes on a big picture box.

    The image boxes are loaded at startup in an array. It places each image box evenly spaced on the picture box (5 across X however many down).

    I want to move those images anywhere in the picture box rearranging the images in any order by draging and dropping or clicking (if easier).

    Unfortunately I am not sure how to start but I can supply some of my code that creates the image boxes with the loaded images:

    ...some search routine in for loop using rowNum as index...

    VB Code:
    1. 'Loads image boxes for picture results display (on picture box)
    2.                 Load frmAttribute.imgResult(rowNum)
    3.                     If ((rowNum Mod 5) <> 0) And ((rowNum \ 5) = 0) Then
    4.                         frmAttribute.imgResult(rowNum).Left = frmAttribute.imgResult(rowNum - 1).Left + _
    5.                                                        (1.5 * frmAttribute.imgResult(0).Width)
    6.                     ElseIf (rowNum Mod 5) = 0 Then
    7.                         frmAttribute.imgResult(rowNum).Top = frmAttribute.imgResult(rowNum - 1).Top + _
    8.                                                       (1.5 * frmAttribute.imgResult(rowNum).Height)
    9.                      ElseIf (rowNum \ 5) = 1 Then
    10.                         frmAttribute.imgResult(rowNum).Top = frmAttribute.imgResult(rowNum).Top + _
    11.                                                       (1.5 * frmAttribute.imgResult(rowNum).Height)
    12.                         frmAttribute.imgResult(rowNum).Left = frmAttribute.imgResult(rowNum - 1).Left + _
    13.                                                       (1.5 * frmAttribute.imgResult(0).Width)
    14.                     End If
    15.                    
    16.                     'Shows picture results
    17.                     frmAttribute.imgResult(rowNum).Visible = True
    18.                         If (rowNum = 1) Then
    19.                             frmAttribute.imgResult(0) = LoadPicture(adoRec.Fields("Path") & "\" & _
    20.                             adoRec.Fields("PictureName") & ".jpg")
    21.                          Else
    22.                             frmAttribute.imgResult(rowNum - 1) = LoadPicture(adoRec.Fields("Path") & "\" & _
    23.                                                           adoRec.Fields("PictureName") & ".jpg")
    24.                         End If
    25.                 adoRec.MoveNext
    26.             Next rowNum

    THANX -Justin-

  2. #2
    Addicted Member
    Join Date
    Oct 2002
    Location
    Somewhere out in space
    Posts
    151
    ok, if i got what you wanted to do right, this should help

    VB Code:
    1. Private Sub Picture1_DragDrop(Index As Integer, Source As Control, X As Single, Y As Single)
    2.  
    3. 'note: the source is the picturebox from where the drag start and
    4. 'index is the picture box where the source was dropped
    5.  
    6. 'Create a temporary picture object
    7. Dim tmpPicture As IPictureDisp
    8.  
    9.     'put the source picture in the temporary one
    10.     Set tmpPicture = Source.Picture
    11.  
    12.     'put the picture from the destination in the source
    13.     Set Source.Picture = Picture1(Index).Picture
    14.  
    15.     'put the temp picture into the destination
    16.     Set Picture1(Index).Picture = tmpPicture
    17.  
    18.     'Free memory used by tmpPicture
    19.     Set tmpPicture = Nothing
    20.    
    21. End Sub

    Hope this helped.

    - Valkan
    'You keep creatures in cages and release them to fight? That's sick!'

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Nov 2002
    Posts
    21
    Thanx will let you know

  4. #4
    Addicted Member
    Join Date
    Oct 2002
    Location
    Somewhere out in space
    Posts
    151
    oups, just one more thing. I forgot to mention that the DragMode property of your pictureboxes must be set to 1 - Automatic and the OleDropMode property set to 1 - manual
    'You keep creatures in cages and release them to fight? That's sick!'

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Nov 2002
    Posts
    21
    haven't forgotten - just been busy today...will let you know

  6. #6

    Thread Starter
    Junior Member
    Join Date
    Nov 2002
    Posts
    21
    Thanx for the suggestion Valkan it worked - basically works like a MIN/ MAX function.

    Just need to implement a good though process for moving an unknown # of pictures (determined by the search method) to any of the positions.

    One more question: I am trying to print these graphics as they exist in the picturebox (sort of like thumbnails). When I try to print the array of pix the printer prints their boolean equivalent. I have been experimenting and ther is something called a standard picture - is this needed to print out a specific picture(s)

    again thanx

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