←Select platform

Url Property

Summary

URL of image data associated with this item.

Syntax
C#
C++/CLI
public Uri Url { get; set; } 
public:  
   property System::Uri^ Url 
   { 
      System::Uri^ get() 
      void set(System::Uri^ value) 
   } 

Property Value

The URL of the image associated with this item. Default value is null.

Remarks

The action taken when setting this value depends on whether the item is already a member of a viewer (it has been added to Items). If the item is not part of a viewer, then the value of Url will be set with the new value and the actions described below will not occur till the item is added to a viewer.

When setting the value of this property (or adding an item to the viewer's Items), the viewer will do the following:

If the new value is null, then any previous image data is deleted. This done by setting the value of Image and SvgDocument to null. The value of Resolution is not changed. This will create an empty item.

If the new value is not null, then the following happens:

  1. The RasterCodecs object stored in RasterCodecsInstance is used to load the URL as follows:

    In either case, the load is performed asynchronously and control is returned back to the user right away. The value of Url is not changed and will still hold the old value.

  2. When the loading finishes (LoadAsyncCompleted or LoadSvgAsyncCompleted occur), The Url property will be updated with the original value passed. Previous data in Image or SvgDocument will be deleted and replaced with the image object (either a RasterImage or SvgDocument depending on LoadUrlAsSvg). The value of Resolution will also be updated with the DPI of the image. When this is done, ItemChanged will occur with information on the item and Reason set to ImageViewerItemChangedReason.Url. If an error occurs during load, ItemError will fire with information about the error. Url, Image, SvgDocument and Resolution will not be updated and will still hold the original data.

In essence, setting the value of Url to null will clear the image data right away.

Setting the value of Url to another value will return control immediately without changing the item, when loading is finished, the values are updated (including Url itself) and ItemChanged will occur.

If an error occur, the item is not changed and ItemError will occur.

ImageUrl property of ImageViewer will update this member if this is the active item when the viewer is used in single item mode.

For more information, refer to Image Viewer Items.

Example
C#
using Leadtools; 
using Leadtools.Controls; 
using Leadtools.Codecs; 
using Leadtools.Drawing; 
 
using Leadtools.ImageProcessing; 
using Leadtools.ImageProcessing.Color; 
using Leadtools.Svg; 
 
string[] urls = 
{ 
   @"http://localhost/myimages/layouttest/200by100_1.png", 
   @"http://localhost/myimages/layouttest/200by100_2.png", 
   @"http://localhost/myimages/layouttest/200by100_3.png", 
   @"http://localhost/myimages/layouttest/100by200_1.png", 
   @"http://localhost/myimages/layouttest/100by200_2.png", 
   @"http://localhost/myimages/layouttest/100by200_3.png" 
}; 
 
int itemIndex = 0; 
_imageViewer.BeginTransform(); 
for (int urlIndex = 0; urlIndex < urls.Length; urlIndex++) 
{ 
   ImageViewerItem item = new ImageViewerItem(); 
   item.Url = new Uri(urls[urlIndex]); 
   item.Text = "Item" + itemIndex; 
   this._imageViewer.Items.Add(item); 
   itemIndex++; 
} 
_imageViewer.EndTransform(); 
Requirements

Target Platforms

Help Version 22.0.2023.1.24
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Controls Assembly
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.