|
-
Dec 4th, 2002, 11:41 AM
#1
Thread Starter
Junior Member
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:
'Loads image boxes for picture results display (on picture box)
Load frmAttribute.imgResult(rowNum)
If ((rowNum Mod 5) <> 0) And ((rowNum \ 5) = 0) Then
frmAttribute.imgResult(rowNum).Left = frmAttribute.imgResult(rowNum - 1).Left + _
(1.5 * frmAttribute.imgResult(0).Width)
ElseIf (rowNum Mod 5) = 0 Then
frmAttribute.imgResult(rowNum).Top = frmAttribute.imgResult(rowNum - 1).Top + _
(1.5 * frmAttribute.imgResult(rowNum).Height)
ElseIf (rowNum \ 5) = 1 Then
frmAttribute.imgResult(rowNum).Top = frmAttribute.imgResult(rowNum).Top + _
(1.5 * frmAttribute.imgResult(rowNum).Height)
frmAttribute.imgResult(rowNum).Left = frmAttribute.imgResult(rowNum - 1).Left + _
(1.5 * frmAttribute.imgResult(0).Width)
End If
'Shows picture results
frmAttribute.imgResult(rowNum).Visible = True
If (rowNum = 1) Then
frmAttribute.imgResult(0) = LoadPicture(adoRec.Fields("Path") & "\" & _
adoRec.Fields("PictureName") & ".jpg")
Else
frmAttribute.imgResult(rowNum - 1) = LoadPicture(adoRec.Fields("Path") & "\" & _
adoRec.Fields("PictureName") & ".jpg")
End If
adoRec.MoveNext
Next rowNum
THANX -Justin-
-
Dec 4th, 2002, 02:58 PM
#2
Addicted Member
ok, if i got what you wanted to do right, this should help
VB Code:
Private Sub Picture1_DragDrop(Index As Integer, Source As Control, X As Single, Y As Single)
'note: the source is the picturebox from where the drag start and
'index is the picture box where the source was dropped
'Create a temporary picture object
Dim tmpPicture As IPictureDisp
'put the source picture in the temporary one
Set tmpPicture = Source.Picture
'put the picture from the destination in the source
Set Source.Picture = Picture1(Index).Picture
'put the temp picture into the destination
Set Picture1(Index).Picture = tmpPicture
'Free memory used by tmpPicture
Set tmpPicture = Nothing
End Sub
Hope this helped.
- Valkan
'You keep creatures in cages and release them to fight? That's sick!'
-
Dec 4th, 2002, 04:23 PM
#3
Thread Starter
Junior Member
-
Dec 4th, 2002, 04:33 PM
#4
Addicted Member
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!'
-
Dec 4th, 2002, 11:56 PM
#5
Thread Starter
Junior Member
haven't forgotten - just been busy today...will let you know
-
Dec 5th, 2002, 08:47 AM
#6
Thread Starter
Junior Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|