Image browser

Richard clone the project on SourceTree and try again? I just tried the same thing and it scrolls well. :slight_smile:

NOTE: I disable the scroll bar when animating due to my reasons above.

The latest link works perfectly, but the dropbox one doesnā€™t (for me at least).
Thanks Mike - perfect :slight_smile:

[quote=303811:@Richard Summers]The latest link works perfectly, but the dropbox one doesnā€™t (for me at least).
Thanks Mike - perfect :)[/quote]
Im going to delete the dropbox version since I have made a bunch of new commits already on this repo.

https://github.com/IntelligentVisibility/filmStripImageBrowser

Yes - itā€™s all good now.
I have the latest version and it works as expected :slight_smile:

Seeing as how this is a public repo, and lots of others will benefit - I have a couple of ideas to expand it which may be very beneficial for everyone:

  1. Display the file name of each image underneath (or above) each image.
  2. Allow each image to be double clicked and opened in itā€™s default application.

Not sure if either of these 2 expansions are possible, but I would presume people would be using this as a kind of file browser, so the expansions make sense.

Just an idea for possible future update considerations to this project :slight_smile:

I need to make time to decouple the UI from my classes to make it easier to implement into current projects.

Richard do you mind opening two issues with those features? Great ideas!
https://github.com/IntelligentVisibility/filmStripImageBrowser/issues

Done! :slight_smile:

@Mike Cotrone - I just rediscovered this today and itā€™s superb! I changed some code in the paint event so that the thumbnails are all the same height.

Here is my code:

[code] // PREPARE CANVAS AESTHETICAL PROPERTIES
g.ForeColor = &c000000
g.FillRect(0,0,me.Width, me.Height)
g.ForeColor = &c9F9E9E
g.DrawLine(0,0, me.Width,0)
g.DrawLine(0,me.Height-1, me.Width, me.Height-1)
g.AntiAlias = True

	// LOOP PICTURE ARRAY TO DRAW EACH IMAGE
	For i As Integer = 0 To Me.aroPicture.Ubound
			
			// PREPARE IMAGE PROPERTIES
			Dim thisLeftPOS, thisTopPOS as Integer
			Dim thisImage as Picture = Me.aroPicture(i).pictureImage
			
			dim ratio as Double = min( (me.Height-4) / thisImage.Height, me.Width / thisImage.Width)
			
			Me.iScaledW  = thisImage.Width * ratio
			Me.iScaledH = thisImage.Height * ratio
			
			// PREPARE IMAGE NAME PROPERTIES
			g.TextSize = 16
			g.TextFont = "System"
			Dim thisImageName as String = Me.aroPicture(i).fFolderItem.Name
			Dim thisImageNameXPOS, thisImageNameYPOS as Integer 
			Dim thisImageNameH as Integer = (g.StringHeight(thisImageName, 800) + 10)
			Dim thisImageNameW as Double = g.StringWidth(thisImageName)
			Dim wrapWidth as Integer
			If  i = 0 Then
					// DRAW FIRST IMAGE ONLY ON CANVAS
					
					// X-POS CALULCATION
					thisLeftPOS = Me.aroPicture(i).left
					// UPDATE RECT X POS
					Me.aroPicture(i).imageRect.Left = thisLeftPOS
					// UPDATE IMAGE NAME X/Y POS
					Me.aroPicture(i).imageNameXpos = thisLeftPOS
					wrapWidth = Me.iScaledW + 4
					
					// Y-POS CALULCATION
					thisTopPOS = 2
					Me.aroPicture(i).imageNameYpos = thisTopPOS + Me.iScaledH + thisImageNameH
					// UPDATE RECT Y POS
					Me.aroPicture(i).imageRect.Top = thisTopPOS
					
			Elseif i <> 0 THEN
					// DRAW ALL REMAINING IMAGES ON CANVAS
					// X-POS CALULCATION
					
					dim  previousratio as Double = min( (me.Height-4) / Me.aroPicture(i-1).pictureImage.Height, me.Width / Me.aroPicture(i-1).pictureImage.Width)
					
					Dim lastImgScaledW as Integer =  (Me.aroPicture(i-1).pictureImage.Width) *  previousratio
					
					Me.aroPicture(i).left = Me.aroPicture(i-1).left  +  lastImgScaledW + me.iImageSpacer
					
					thisLeftPOS = Me.aroPicture(i).left
					// UPDATE RECT X/Y POS
					Me.aroPicture(i).imageRect.Left = thisLeftPOS
					// UPDATE IMAGE NAME X/Y POS
					Me.aroPicture(i).imageNameXpos = thisLeftPOS
					wrapWidth = Me.iScaledW + 4
					
					// Y-POS CALULCATION
					thisTopPOS = 2
					Me.aroPicture(i).imageNameYpos = thisTopPOS + Me.iScaledH + thisImageNameH
					// UPDATE RECT Y POS
					Me.aroPicture(i).imageRect.Top = thisTopPOS
			End If
			
			// DRAW IMAGE
			g.DrawPicture(thisImage, thisLeftPOS, thisTopPOS, Me.iScaledW, Me.iScaledH, 0, 0, thisImage.Width, thisImage.Height)
			
			// DRAW IMAGE NAME
			if Me.bShowImageNames = True Then
					g.ForeColor = &c000000
					dim test as integer = g.TextSize
					g.DrawString(thisImageName, Me.aroPicture(i).imageNameXpos, Me.aroPicture(i).imageNameYpos, wrapWidth)
			end if
			
	Next i
	[/code]

Iā€™m still tracking down the doubl-click methods, though. As this is not enough to get the correct image to open on a double-click. Also, I havenā€™t yet worried about the image names.

THis has been so helpful, thanks for your (and othersā€™) hard work!

[quote=320381:@Dave Kondris]@Mike Cotrone - I just rediscovered this today and itā€™s superb! I changed some code in the paint event so that the thumbnails are all the same height.

Here is my code:

[code] // PREPARE CANVAS AESTHETICAL PROPERTIES
g.ForeColor = &c000000
g.FillRect(0,0,me.Width, me.Height)
g.ForeColor = &c9F9E9E
g.DrawLine(0,0, me.Width,0)
g.DrawLine(0,me.Height-1, me.Width, me.Height-1)
g.AntiAlias = True

	// LOOP PICTURE ARRAY TO DRAW EACH IMAGE
	For i As Integer = 0 To Me.aroPicture.Ubound
			
			// PREPARE IMAGE PROPERTIES
			Dim thisLeftPOS, thisTopPOS as Integer
			Dim thisImage as Picture = Me.aroPicture(i).pictureImage
			
			dim ratio as Double = min( (me.Height-4) / thisImage.Height, me.Width / thisImage.Width)
			
			Me.iScaledW  = thisImage.Width * ratio
			Me.iScaledH = thisImage.Height * ratio
			
			// PREPARE IMAGE NAME PROPERTIES
			g.TextSize = 16
			g.TextFont = "System"
			Dim thisImageName as String = Me.aroPicture(i).fFolderItem.Name
			Dim thisImageNameXPOS, thisImageNameYPOS as Integer 
			Dim thisImageNameH as Integer = (g.StringHeight(thisImageName, 800) + 10)
			Dim thisImageNameW as Double = g.StringWidth(thisImageName)
			Dim wrapWidth as Integer
			If  i = 0 Then
					// DRAW FIRST IMAGE ONLY ON CANVAS
					
					// X-POS CALULCATION
					thisLeftPOS = Me.aroPicture(i).left
					// UPDATE RECT X POS
					Me.aroPicture(i).imageRect.Left = thisLeftPOS
					// UPDATE IMAGE NAME X/Y POS
					Me.aroPicture(i).imageNameXpos = thisLeftPOS
					wrapWidth = Me.iScaledW + 4
					
					// Y-POS CALULCATION
					thisTopPOS = 2
					Me.aroPicture(i).imageNameYpos = thisTopPOS + Me.iScaledH + thisImageNameH
					// UPDATE RECT Y POS
					Me.aroPicture(i).imageRect.Top = thisTopPOS
					
			Elseif i <> 0 THEN
					// DRAW ALL REMAINING IMAGES ON CANVAS
					// X-POS CALULCATION
					
					dim  previousratio as Double = min( (me.Height-4) / Me.aroPicture(i-1).pictureImage.Height, me.Width / Me.aroPicture(i-1).pictureImage.Width)
					
					Dim lastImgScaledW as Integer =  (Me.aroPicture(i-1).pictureImage.Width) *  previousratio
					
					Me.aroPicture(i).left = Me.aroPicture(i-1).left  +  lastImgScaledW + me.iImageSpacer
					
					thisLeftPOS = Me.aroPicture(i).left
					// UPDATE RECT X/Y POS
					Me.aroPicture(i).imageRect.Left = thisLeftPOS
					// UPDATE IMAGE NAME X/Y POS
					Me.aroPicture(i).imageNameXpos = thisLeftPOS
					wrapWidth = Me.iScaledW + 4
					
					// Y-POS CALULCATION
					thisTopPOS = 2
					Me.aroPicture(i).imageNameYpos = thisTopPOS + Me.iScaledH + thisImageNameH
					// UPDATE RECT Y POS
					Me.aroPicture(i).imageRect.Top = thisTopPOS
			End If
			
			// DRAW IMAGE
			g.DrawPicture(thisImage, thisLeftPOS, thisTopPOS, Me.iScaledW, Me.iScaledH, 0, 0, thisImage.Width, thisImage.Height)
			
			// DRAW IMAGE NAME
			if Me.bShowImageNames = True Then
					g.ForeColor = &c000000
					dim test as integer = g.TextSize
					g.DrawString(thisImageName, Me.aroPicture(i).imageNameXpos, Me.aroPicture(i).imageNameYpos, wrapWidth)
			end if
			
	Next i
	[/code]

Iā€™m still tracking down the doubl-click methods, though. As this is not enough to get the correct image to open on a double-click. Also, I havenā€™t yet worried about the image names.

THis has been so helpful, thanks for your (and othersā€™) hard work![/quote]

EDIT: The forum went down, but I wanted to add that this line:

dim ratio as Double = min( (me.Height-4) / thisImage.Height, me.Width / thisImage.Width)

is one I got way back some time ago from somewhere, probably on this forum. I canā€™t live without it for resizing images anymore.