You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
1.2 KiB
38 lines
1.2 KiB
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 ; } }
|
|
}
|
|
|