/// <summary> /// Opens a form that allows to select image of image collection /// and returns the selected image. /// </summary> /// <param name="filename">The filename of image file.</param> /// <returns>Selected image.</returns> public static VintasoftImage SelectImageFromFile(string filename) { // temporary image for image in current file VintasoftImage image; // selected index int index; // create image collection using (ImageCollection images = SelectImageFromFile(filename, out index)) { if (index == -1) { return(null); } // get the selected image image = images[index]; // remove the selected image from image collection images.Remove(image); // if the count of images is more than one if (images.Count > 1) { images.ClearAndDisposeItems(); } } return(image); }