Consulting

Results 1 to 5 of 5

Thread: Image viewer with images control

  1. #1

    Image viewer with images control

    Hello,

    how can we make an image viewer
    with in a frame1 and image controls

    we like to go from out our database access to load where the ID from the person
    and get all his image URLs and add them into the frame1 and create the image controls

    like this image i created

    Thanks45421245212.jpg

  2. #2
    Hello,

    how can i add an image in every msforms.image
    when we use imagepath with every time a other location/file


    Private imgLts(20) As MSForms.Image
    Dim strInPath As String
    Dim strOutPath As String
    strOutPath = ThisWorkbook.Path & "\some.jpg" 'sample will be replace with other images in a loop
    
    
    
    
    
    
    here we like to replace all the images with a picture from the strOutPath
    but it only insert in all image with same file
    
    
    
    
        For i = 1 To 1
    For j = 1 To 7
        k = i + (1 * j)
        Set imgLts(k) = Frame2.Controls.Add("Forms.Image.1", "cmd1")
        With imgLts(k)
            .Top = i * 6
            .Left = (j * 50) - 55 + 12
            .Height = 54
            .Width = 48
            .Picture = LoadPicture(strOutPath)
            .PictureSizeMode = fmPictureSizeModeZoom
        End With
    Next j
    Next i

  3. #3
    i have tried to get all items from the listbox and works

    For IntIndex = 0 To .ListCount - 1
           LoadingImages (.Column(5, IntIndex))
    Next
    End With
    but i can't manage to add seperate images ?
    i get in the pictures the same one

    Sub LoadingImages(m_url As String)
    Dim imageurl As String
    Dim fileName As String
    
    imageurl = m_url
    fileName = Environ("temp") & "" & Mid(imageurl, InStrRev(imageurl, "/") + 1)
        
    
    
        ' size of thumbnail
        Dim lngSide As Long
        lngSide = 50
    
    
    
    
        Dim ws As Worksheet
        Set ws = ThisWorkbook.Sheets.Add
    
    
         Dim cht As Chart
        Set cht = ws.Shapes.AddChart(xlColumnClustered, _
            Width:=lngSide, _
            Height:=lngSide).Chart
    
    
        Application.DisplayAlerts = False
        ws.Delete
        Application.DisplayAlerts = True
    
    
        For i = 1 To 1
    For j = 1 To 1 
        k = i + (1 * j)
        Set cmdLots(k) = Frame2.Controls.Add("Forms.Image.1", "cmd1")
        With cmdLots(k)
            .Top = i * 6
            .Left = (j * 50) - 55 + 12
            .Height = 54
            .Width = 48
            .BackColor = RGB(50, 50, 0)
           .Picture = LoadPicture(fileName) 'get same one ????
        .PictureSizeMode = fmPictureSizeModeZoom
        End With
    Next j
    Next i
    anyone please

    -Thank you

  4. #4
    i tried it this way now
    and still replace all the image

    what are we missing??

           LoadingImages .Column(5, intindex), intindex + 1
    Sub LoadingImages(m_url As String, m_index As Integer)
    Dim imageurl As String
    Dim fileName As String
    
    
    
    
    imageurl = m_url 
    fileName = Environ("temp") & "" & Mid(imageurl, InStrRev(imageurl, "/") + 1)
        
    
    
       ' size of thumbnail
        Dim lngSide As Long
        lngSide = 50
    
    
        Dim ws As Worksheet
        Set ws = ThisWorkbook.Sheets.Add
    
    
    
    
         Dim cht As Chart
        Set cht = ws.Shapes.AddChart(xlColumnClustered, _
            Width:=lngSide, _
            Height:=lngSide).Chart
    
    
    
    
        Application.DisplayAlerts = False
        ws.Delete
        Application.DisplayAlerts = True
    
    
       
        For i = 1 To 1
    For j = 1 To m_index
        k = i + (1 * j)
        Set cmdLots(k) = Frame2.Controls.Add("Forms.Image.1", "cmd" & m_index)
        With cmdLots(k)
            .Top = i * 6
            .Left = (j * 50) - 55 + 12
            .Height = 54
            .Width = 48
            .BackColor = RGB(50, 50, 0)
            .PictureSizeMode = fmPictureSizeModeZoom
            .Picture = Nothing
        End With
        
        
    Next j
    Next i
    
    
            
           For Each ctrl In Frame2.Controls
           '        MsgBox (ctrl.name) 'i used this and seems it show cmd1 cmd1 cmd1 cmd 2 cmd 2 cmd2 cmd3 cmd3 cmd3
          'so i guess that's way it replace them....
          'but how to fix it please
    
    
           If TypeName(ctrl) = "Image" Then
    
    
           If ctrl.name = "cmd1" Then 
           ctrl.Picture = LoadPicture(fileName)
           Exit Sub
           End If
           End If
           Next ctrl     
           End If
    
    End Sub

  5. #5
    i have made a sample with the access database where the images are stored

    hope someone can helpme now

    thank you
    Attached Files Attached Files

Posting Permissions

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