+ Reply to Thread
Results 1 to 3 of 3

Image viewer with images control

Hybrid View

1912dummy Image viewer with images... 01-20-2020, 01:54 PM
1912dummy Re: Image viewer with images... 01-20-2020, 03:21 PM
1912dummy Re: Image viewer with images... 01-21-2020, 12:28 PM
  1. #1
    Registered User
    Join Date
    10-25-2019
    Location
    Belgium
    MS-Off Ver
    2018
    Posts
    20

    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


    i have tried to get all items from the listbox and works
    [CODE]
    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 the same images ????
        .PictureSizeMode = fmPictureSizeModeZoom
        End With
    Next j
    Next i
    its it also possible to add .picture like 8 add a row
    and then start a new row if there are more pictures in the listbox
    so it will be automatic order it
    like on my image?

    and if possible we like to add a click event aswell on every .picture we want to click on
    to do some work

    Thank you
    hope someone can help me out

    thank you
    Attached Images Attached Images

  2. #2
    Registered User
    Join Date
    10-25-2019
    Location
    Belgium
    MS-Off Ver
    2018
    Posts
    20

    Re: Image viewer with images control

    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

  3. #3
    Registered User
    Join Date
    10-25-2019
    Location
    Belgium
    MS-Off Ver
    2018
    Posts
    20

    Re: Image viewer with images control

    i have created a demo file
    hope someone can helpme out please


    it takes the image locations from out our database
    Attached Files Attached Files
    Last edited by 1912dummy; 01-21-2020 at 02:27 PM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Save Image from open Windows Photo Viewer
    By Bob@Sun in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 07-04-2013, 12:53 PM
  2. turning off the visibility of an image viewer
    By Suraj3825 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-03-2013, 12:08 PM
  3. Displaying and Updating Image Dynamically (ActiveX Image Control?)
    By VTHokie11 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-02-2011, 10:57 AM
  4. Cannot open image in Windows Picture and Fax Viewer
    By bagullo in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-30-2011, 03:03 AM
  5. AutoCAD Viewer Control for Excel
    By fire_water in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-01-2009, 02:48 PM
  6. Code an image viewer inside XL
    By quartz in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-15-2006, 09:45 AM
  7. HOW TO DISPLAY DIFFERENT IMAGES IN EXCEL USING IMAGE CONTROL?
    By labouche10@yahoo.com in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-05-2005, 11:05 PM
  8. [SOLVED] Userform Image Control and embedded images
    By tim in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 04-05-2005, 09:06 AM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1