Welcome to LEAD Support Forum Login | Register | Faq  

    LEAD Support Forum
  Resource to find answers and post technical questions about LEAD products.
Search    
   

Re: Loading tiff files in thumnailbrowser
Started by danny_live at 02-21-2008 10:31. Topic has 1 replies.

Print Search « Previous Thread Next Thread »
  02-21-2008, 10:31
danny_live is not online. Last active: 2/25/2008 6:12:20 AM danny_live

Not Ranked
Joined on 02-21-2008
Posts 4
Loading tiff files in thumnailbrowser
Reply Quote
I have two codes to load a tiff files to the thumbnailbrowser.

1) Using a FolderBrowserDialog

private void openToolStripMenuItem_Click(object sender, EventArgs e)
{
FolderBrowserDialog dlg = new FolderBrowserDialog();
dlg.Description = "Select the directory that contains the images you want.";
dlg.ShowNewFolderButton = false;

dlg.SelectedPath = @"C:\Documents and Settings\admin\Desktop\tiffFileFldr";

if (dlg.ShowDialog(this) == DialogResult.OK)
{
try
{
if (Thumbnail.IsLoadingThumbnails)
Thumbnail.CancelLoadingThumbnails();

Thumbnail.Items.Clear();
Thumbnail.LoadThumbnails(dlg.SelectedPath, "*.*", RasterThumbnailBrowserLoadFlags.None);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
finally
{
updateMyControls();
}
}
Here all files that are in the folder get into the thumbnailbrowser. but only the first page of the files are displayed. I need all the pages to be displayed followed by the next file's pages.

2) Using OpenFileDialog

private void singleFileToolStripMenuItem_Click(object sender, EventArgs e)
{
string file_name = string.Empty;
OpenFileDialog dlg = new OpenFileDialog();
dlg.Filter = "Tagged File Formats (*.tif, *.tiff) Files|*.tif;*.tiff";

Thumbnail.Items.Clear();

if (dlg.ShowDialog(this) == DialogResult.OK)
{
file_name = dlg.FileName;
}
RasterCodecs codecs = new RasterCodecs();
codecs.LoadPage += Page_Load;
RasterImage rstImg = codecs.Load(file_name);

dlg.Dispose();
}

private void Page_Load(object sender, Leadtools.Codecs.CodecsPageEventArgs e)
{
if (e.State == CodecsPageEventState.After)
{
RasterImageListItem item = new RasterImageListItem(e.Image, e.Page, "Item" + e.Page.ToString());
Thumbnail.Items.Add(item);
Application.DoEvents();
}
}

Here I am using OpenFileDialog so as to open a file having multiple pages. All pages are displayed but when I select any thumbnailbrowser page only the first page is displayed in the viewer. More ever the progressive time taken is very slow.

Below is the code of thumbnailbrowser selected index changed code for both the cases

private void Thumbnail_SelectedIndexChanged(object sender, EventArgs e)
{
try
{
RasterImageListItemCollection selectedItems = Thumbnail.SelectedItems;

if (selectedItems.Count > 0)
{
RasterImageListItem item = selectedItems[0];

if (item.FileName == null)
{

ImgViewer.Image = item.Image;
}

if (item.FileName != _currentFileName)
{
_currentFileName = item.FileName;
ImgViewer.Image = Thumbnail.Codecs.Load(
_currentFileName,
0,
CodecsLoadByteOrder.BgrOrGray,
item.Page,
item.Page);
}
}
else
{
ImgViewer.Image = null;
_currentFileName = null;
}
}
catch
{
ImgViewer.Image = null;
}
finally
{
//_lblViewer.Invalidate();
updateMyControls();
}
}
   Report 
  02-22-2008, 8:40
Maen Hasan is not online. Last active: 10/5/2008 10:18:54 AM Maen Hasan



Top 10 Posts
Joined on 08-05-2004
Posts 1,747
Re: Loading tiff files in thumnailbrowser
Reply Quote
Hello,

If you want to populate a RasterImageList control with thumbnail of all the pages in a group of multi-page image files, you will need to browse for the files yourself then load the multi-pages one by one.

Currently, we don't have an automatic function in our .NET classes to expand all pages into thumbnails. I have submitted a feature request number 6708AMN to our engineers. I will update you with the status of this issue when I receive any updates from our engineers.

Thanks,
Maen Badwan
LEADTOOLS Technical Support
   Report 
Post
LEAD Support Fo... » General » Feature Request... » Re: Loading tiff files in thumnailbrowser

Powered by Community Server, by Telligent Systems