Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2004
    Posts
    64

    Unanswered: dfisplay thumbnail images on a form

    Hi All,
    I would like to make an image viewer inn access 2000 and was wondering the bast way to go ahead. Would I be better designing a form with a microsoft imagelist control to hold the images and a microsoft listview control to view the images or is ther an easier way to display thumbnail images?
    Thanks

  2. #2
    Join Date
    Nov 2003
    Posts
    1,487
    Depending upon what you really what to do...you don't necessarily need to reinvent the wheel to to it.

    You can use the Microsoft Office FileDialog object to view all your images and make selections from it. The dialog can hold a full screen of thumbnail images if you size it to do so.

    Place the following code into the OnClick event of a Command Button:

    Code:
       ' Need 'Microsoft Office 10.0 Object Library' set in References
       ' for this to work.  Place the code into the OnClick event of a
       ' Command Button or place it into a Function procedure.
       On Error GoTo dlg_Error
       Dim dlg As Object
       Dim vrtSelectedItem As Variant
       
       ' 1 is the File Open Dialog       -  msoFileDialogOpen
       ' 2 is the File SaveAs Dialog     -  msoFileDialogSaveAs
       ' 3 is the File Browser (Picker)  -  msoFileDialogFilePicker
       ' 4 is the Folder Browser (Picker)-  msoFileDialogFolderPicker
        Set dlg = Application.FileDialog(msoFileDialogFilePicker)
        With dlg
          ' Set the File Dialog Window Title
          .Title = "Select A Photo For Further Processing..."
          ' Clear any File Dialog Filters
          .Filters.Clear
          ' Add a New File Dialog Filters. Filters don't apply to a Folder Dialog
          .Filters.Add "Images", "*.bmp; *.gif; *.jpg; *.jpeg; *.wmf", 1
          .Filters.Add "All files", "*.*"
          ' Set the Name for the action button in our File Dialog
          .ButtonName = "Process Photo"
          ' Turn OFF File multi Select. We don't need this now.
          .AllowMultiSelect = False
          ' Set the File Dialog window to show Thumbnamils
          .InitialView = msoFileDialogViewThumbnail
              ' All Available Views:
                    ' msoFileDialogViewDetails
                    ' msoFileDialogViewLargeIcons
                    ' msoFileDialogViewList
                    ' msoFileDialogViewPreview
                    ' msoFileDialogViewProperties
                    ' msoFileDialogViewSmallIcons
                    ' msoFileDialogViewThumbnail
                    ' msoFileDialogViewWebView
          ' Set folder in which the File Dialog will start from.
          .InitialFileName = CurDir
          ' If the Action button is selected and a file has indeed been
          ' selected then place the path & file name into the PhotoPath
          ' field on Form.
          If .show = -1 And Not IsNull(.SelectedItems) Then
             For Each vrtSelectedItem In .SelectedItems
                ' The TextBox on your Form named PhotoPath that may be 
                ' bound to a table.
                Me.PhotoPath = vrtSelectedItem
             Next vrtSelectedItem
          End If
        End With
    Exit_dlg_Error:
        Set dlg = Nothing   ' Free memory
        Exit Sub
        
    dlg_Error:
        MsgBox Error
        Resume Exit_dlg_Error
    .
    Environment:
    Self Taught In ALL Environments.....And It Shows!


Posting Permissions

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