Resize Window Based Upon Photo Size - August 2013

If you download this tip please consider making a modest donation.

I have an application that shows an enlarged photo in a popup window when the client clicks the photo's thumbnail. I wondered if I could develop some code to allow the client to click a 'Next' or 'Previous' button to show the next/previous photo in the collection. They could 'scroll' through the collection not having to close the popup, click another thumbnail, etc. The key element in the process is to resize the window based upon the photo's size.

I searched the web and found the resizeTo function. With some trial and error I was able to use the function to resize the open window when the Next or Previous buttons are clicked. I created a demo application and made it the August 2013 tip-of-the-month. Click here to run the demo.

The Demo Application

The Asp.Net, VB.Net, VS/2008 project ResizeWindowBasedUponPhotoSize is documented here. The client clicks on one of the thumbnails to display the full size photo in a popup window.


Click one of the thumbnails.

The selected photo is shown in a popup window.
Click 'Previous' or 'Next' to show the previous/next photo in the collection.
Click 'Close' or click on the photo to close the window.

Operative Code

The GetResizeTo Function sets the OnClientClick values

The GetResizeTo Function

Download the VB.Net Code

Download the source code by clicking on the zipped file name. Click here to run the demo application.

Download - Source Zipped File Size
VS/2008 VB.Net, ASP.Net Solution ResizeWindowBasedUponPhotoSize.zip 1,150K

Previous Tip    Tip Index   Next Tip

Home

Updated 2014/12/03