Atalasoft
Welcome to Atalasoft Community Sign in | Join | Help
in

Adding an alternative image.

Last post 10 Jan 2007, 11:34 AM by Sean Mckenna. 10 replies.
Sort Posts: Previous Next
  •  06 Dec 2006, 9:21 AM 11167

    Adding an alternative image.

    How do I add an image of my choice whilst keeping the file ?

    E.G -
    I have a file "wordFile.doc" but in the thumbnail viewer I want to display "default.jpg".  When the user clicks on the file I want to be able to extract file details from "wordfile.doc" and not "default.jpg".

    In short how do I add a file to the thumbnail collection but display a different picture in code ?
  •  08 Dec 2006, 11:40 AM 11174 in reply to 11167

    Re: Adding an alternative image.

    When clicking on a thumbnail, in order to display an image in the main viewer, you need to respond to the ThumbnailClicked event.  It's up to you to code what you want to happen in your application when it's clicked.  Our demo application will load the full-size image of the thumbnail that's clicked, but you can do whatever you would like in this event.  Does that answer your question?
    Bill Bither
    Atalasoft
  •  12 Dec 2006, 6:30 AM 11185 in reply to 11174

    Re: Adding an alternative image.

    Not quite.

     I need to load lets say 10 images in the thumbnail viewer.

    I loop through the files and add them to the thumbnail viewer but then I come across a file which is not an image type such as "file.doc".  I want to be able to display in the thumbnail viewer a  different image for that file type but when the user clicks on that image I would still like get to the file details of "file.doc".

    I
     

  •  19 Dec 2006, 9:49 AM 11205 in reply to 11185

    Re: Adding an alternative image.

    Anyone ??
  •  21 Dec 2006, 11:43 AM 11218 in reply to 11205

    Re: Adding an alternative image.

    Sure you can do this, just substitute an image in the thumbnail view while you are loading the images and come across a non image file.  You can make your own image icon so your users will know its not an image.  When you click on a thumbnail, you will need to find out if the thumbnail is for an image or non-image file and either show the file information or display the image.
    Sean McKenna
    Atalasoft Development Team
  •  28 Dec 2006, 6:28 AM 11232 in reply to 11218

    Re: Adding an alternative image.

    The problem with that is that when the user clicks on an alternative image there is no way to tell which file it represents.
  •  28 Dec 2006, 9:10 AM 11234 in reply to 11232

    Re: Adding an alternative image.

    Depending on how you've coded your application, the FilePath property in the Thumbnail class could have the filename.  However if the thumbnail was added manually, this is likely to be null, in which case you can add the filename to the read/write Tag property and keep track if it that way.
    Bill Bither
    Atalasoft
    Filed under:
  •  03 Jan 2007, 8:24 AM 11249 in reply to 11234

    Re: Adding an alternative image.

    You have lost me a little.

    If I add an image with the following :

     

     foreach (DataRow row in clsDesktopDocs._desktopDocuments.Tables["tblDocument"].Rows)
      {

        int index;
        string fExtension = Path.GetExtension(row["FileName"].ToString());
        index = VALIDFILETYPES.IndexOf(fExtension.ToUpper());
        if (index != -1) // If the file extension is an image type
        {
           desktopThumbs.AddImage(row["FileName"].ToString(), "New File");
         }
        else // If a thumbnail cannot be generated then use the default image
        {  
           AtalaImage Image = new AtalaImage(Application.StartupPath + "\\imgUnableToDisplay.jpg");
           desktopThumbs.AddImage(Image);
        }                 
    }

    Then how do I add to the tag property ? 

  •  07 Jan 2007, 10:27 PM 11255 in reply to 11249

    Re: Adding an alternative image.

    Are you using DotImage 3.0?  The interface changed a bit in 4.0 for adding thumbnails.  Now the code looks like this:

    thumbnailViewer.Items.Add(filename, "New File");

    However you can also add a thumbnail class like this:

    Thumbnail thumb = new Thumbnail(filename, "New File");
    thumb.Tag = anyObject;
    thumbnailViewer.Items.Add(thumb);

    That should allow you to add anything you want to the thumbnail object that you can then access from the collection later.

    Hope that helps.


    Bill Bither
    Atalasoft
  •  08 Jan 2007, 11:13 AM 11264 in reply to 11255

    Re: Adding an alternative image.

    Thanks Bill,

     "Atalasoft.Imaging.ImageProcessing.Thumbnail" or "Atalasoft.Imaging.WinControls.Thumbnail" ?

    Neither constructor seems to support these parameters in version 3.0.

    The wincontrols thumbnail supports no parameters and the imageprocessing thumbnail supports only size as a parameter.
     

  •  10 Jan 2007, 11:34 AM 11269 in reply to 11264

    Re: Adding an alternative image.

    Bill was talking about 4.0.  To do this in 3.0, there is no tag property, so you will need to keep track of the filenames yourself.
    Sean McKenna
    Atalasoft Development Team
View as RSS news feed in XML