Images
From Visual WebGui Wiki
| This article missing it's contents and needs writing. Please help contributing to this wiki and add contents. |
Contents |
Images - Using images in Visual WebGui
Overview
Visual WebGui is based on ASP.NET and is actually a web deployment platform.
As a result, images used in Visual WebGui need to be served by the server to the client and are not stored locally on the client (appart from some caching scenarios).
The Visual WebGui server is required to create a unique request path for every image it can serve.
these special request types are created by the Visual WebGui ResouceHandle.
See Also
Regular use
By default when adding images to your application through the Form designer, the designer looks for images in the Resources\Images and Resources\Icons directories located in the root directory of the VWG Application project. These locations can be reconfigured in the General tab of the project project properties page, under the "Directories" section. The result is that behind the scenes these images are created in the InitializeComponent method of the Form as ImageResourceHandle instances.
When using a Class Library project, the images still need to be located in the same place - in the location where the Web.config "Directory" items for the "Images" and "Icons" point to.
The default location of the Resource folder(s) can be changed using web.config settings.
Remember the folder names (Images, Icons etc.) set in web.config, they are case sensitive when used in code.
Special cases
- Images located in a Database can be retreived using a DatabaseResourceHandle.
- Images retrieved from other Virtual Directories can be retrieved using the UrlResourceHandle.
Using the UrlResourceHandle, you will need to make sure your application has read access to that file in that Virtual Directory. - Images either dynamically generated or retreived from other locations can be used with the Visual WebGui Gateway.
Browsing for images in Library projects
Visual WebGui Version 6.3 and earlier
Library projects (Visual WebGui Library / WebGui Control Library) do not have a web.config file, so using the designer in those projects, to browse for images, will not work, as the designer has no knowledge of where to look for the Resources folder. To work around this limitation, you can simply make a copy of a web.config from any of your applications and paste it into the Library project and then browsing for images will look in the local Resources within the Library project (by default).
If needed, you can edit this new web.config file (within the Library project) and point the Resources folder to any accessible folder on your workstation.
At runtime, you must make sure the resources are accessible to your application, as at runtime then by default, those resources will have to be available within your application, unless they are embedded resources or your application is using a gateway to retrieve them from non-default application Resource folders.
Visual WebGui Version 6.4 and later
In version 6.4 and later, the version 6.3 method above will work quite well, but the prefered method is to set the "Config File Path" property within the General tab of a Library Project. Use this path to point to a web.config file (in your application project as an example) and the designer will browse for images within that application project, based on the settings for paths to Resources folder within that web.config file.
If a "Config File Path" is set for a Library project and you have a web.config file (based on the 6.3 method) within the project, the local web.config file will override the "Config file path" setting.
References
Forum threads
- Folder names of images are case sensitive when used in code
- Loading and Saving images to database
- Dynamically loading images stored on fileserver (DynamicStreamResourceHandle) - remember to add cleanup code
- How to show images included in your application as a component resource, like within the .resx file of a form
- Integrating Visual LightBox image manager into Visual WebGUi
- Accessing Images outside of the Resource folders
- Obtaining thumbnails of images using a Gateway
Code samples
- How to display dynamic images stored in a database in Visual WebGui application
- Using DatabaseResourceHandle to display dynamic images stored in a database
- Using DataBaseResourceHandle to retrieve dynamic images and resize them within the GetDataReader method
- Gateway demo - If the link does not work for you, you can find that application in this issue here by searching for thread number "29731".
- Windows Forms to Visual Webgui conversion sample using images from NorthWind demo database
- Gauges sample on how to dynamically load images
Other references
- Visual WebGui image viewing capabilities - best suited by using DHTML image viewers
- Code Project ASP.NET Thumbnail image viewer
- Dart Zoom image viewer for ASP.NET
- jQuery VisualLightBox image library manager
- Creating Picture Gallery using Windows Azure Blob storage (forum thread here)
- EasySlider image jQuery based slider control
