DBPix Sample Source Code: Embedded_Main Back to sample
Option Compare Database
Option Explicit
Private Sub DBPixMain_ImageModified()
' The main image has been changed update the thumbnail
If DBPixMain.ImageBytes > 0 Then
DBPixThumb.ImageLoadBlob (DBPixMain.Image) ' Copy/Paste is faster, if you don't mind overwriting the clipboard
' DBPixMain.ImageCopy
' DBPixThumb.ImagePaste
' Update the image info
Me("ThumbWidth") = DBPixThumb.ImageWidth
Me("ThumbHeight") = DBPixThumb.ImageHeight
Me("DetailWidth") = DBPixMain.ImageWidth
Me("DetailHeight") = DBPixMain.ImageHeight
Else
' Clear the thumbnail
DBPixThumb.ImageClear
' Update the image info
Me("ThumbWidth") = 0
Me("ThumbHeight") = 0
Me("DetailWidth") = 0
Me("DetailHeight") = 0
End If
End Sub
' Batch-Load button clicked: Load an entire folder of images (into new records)
Private Sub btnBatchLoad_Click()
On Error GoTo Finish
Dim strFile As String
Dim strFullPath As String
Dim strFolderName As String
' Display a 'Browse for folder' dialog - see 'BrowseForFolder' module
strFolderName = BrowseFolder("Select folder to load images from")
If Not IsEmpty(strFolderName) And Not strFolderName = "" Then
strFile = Dir(strFolderName + "\" + "*.jpg", vbNormal)
While (Not StrComp(strFile, ""))
If Len(strFile) > 1 Then
strFullPath = strFolderName + "\" + strFile
DoCmd.GoToRecord , , acNewRec
DBPixMain.ImageLoadFile (strFullPath)
End If
strFile = Dir
Wend
End If
Finish:
End Sub
Back to sample
|