using System.IO ; using System.Drawing ; using Manina.Windows.Forms ; // -------------------------------------------------------------------- public class ChartImage { private string mFullPath ; private dynamic mConfig ; private Image mImage ; private ImageListViewItem mImageListViewItem ; public ChartImage( string key, string fullPath ) { mFullPath = fullPath ; mConfig = Program.dataConfig.data[ key ] ; mImage = Image.FromFile( fullPath ) ; // NOTE: Thumbnails are cached by ImageListViewItem GUID, so we reuse these objects, // instead of creating new ones every time we reload the search results. mImageListViewItem = new ImageListViewItem( fullPath ) ; mImageListViewItem.Tag = this ; mImageListViewItem.Text = caption() ; } public string caption() { string caption = (mConfig != null) ? mConfig["caption"] : null ; if ( caption == null ) caption = Path.GetFileNameWithoutExtension( mFullPath ) ; return caption ; } public Image image { get { return mImage ; } } public ImageListViewItem imageListViewItem { get { return mImageListViewItem ; } } }