using ThumbnailEx to load GdViewer

Discussions about the ThumbnailEx control of GdPicture.NET.
Post Reply
markusr
Posts: 3
Joined: Thu Sep 08, 2011 1:19 am

using ThumbnailEx to load GdViewer

Post by markusr » Thu Sep 08, 2011 1:29 am

Hey Guys,

(latest version, c#, VS2010)

Am I using this component backwards?

I am playing with the "Document Viewer" sample.

I want to load 1-n images from a directory. Then when the user clicks on a thumbnail I want to display the image in the GDViewer.

Code: Select all

            
            using (var openFileDialog = new OpenFileDialog())
            {
                openFileDialog.Multiselect = true;
                if (openFileDialog.ShowDialog() == DialogResult.OK)
                {
                    foreach (var s in openFileDialog.FileNames)
                        ThumbnailEx1.AddItemFromFile(s);
                }
            }
in:

Code: Select all

        private void ThumbnailEx1_ItemSelectionChanged(int Idx, bool Selected)
        {
            var s = ThumbnailEx1.GetItemFileSource(Idx);
        } 
s always = "".

How do I get the thumbnails source to the Viewer?

-Markus

markusr
Posts: 3
Joined: Thu Sep 08, 2011 1:19 am

Re: using ThumbnailEx to load GdViewer

Post by markusr » Thu Sep 08, 2011 1:43 am

Sorry Guys,

That was an easy one. It first felt like DisplayFromFile() would always show the loadfile dialog. However, since I was using GetItemFileSource() which always returned "" (since I did not LoadFromDirectory) it would display the dialog.

If I put all my ducks in a row, it works as I wish.

Code: Select all

        private void ThumbnailEx1_ItemSelectionChanged(int Idx, bool Selected)
        {
            if (selected)
            { 
                 var s = ThumbnailEx1.GetItemText(Idx);
                 GdViewer1.DisplayFromFile(s);
            }
        } 
-Markus

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests