Thumbnail Image Viewer

This is the forum for miscellaneous technical/programming questions.

Moderator: 2ffat

Thumbnail Image Viewer

Postby lago » Tue Aug 11, 2015 3:37 pm

Hello, im new at this forum, my name is Jorge. Sorry for my bad english. I have a question about the tactic to make a thumbnail viewer.

Please, someone can tell me how can i make a simple jpeg thumb viewer?

Actualy i use FreeImage for resampling images, only want the way to make a simple thumb system. Only load a litte image with the filename.

Im only need one like this: http://www.lohninger.com/thumbnails.html (this example program is in delphi :() this will perfect for me.


Thanks for all!
lago
 
Posts: 1
Joined: Tue Aug 11, 2015 3:26 pm

Re: Thumbnail Image Viewer

Postby jayden » Fri Aug 28, 2015 10:48 am

You can create a TFlowLayout, place each image inside a rectangle and give the TRectangle margin's and styling. This can be done in code or at design time - if your images are static then do it at design time otherwise you can do it in code, something like this:
Code: Select all
    ....
   //Lets say we know you have images 1-5.jpg in the documents dir
   String imagePath = System::Ioutils::TPath::GetDocumentsPath();
   TFlowLayout *fl = new TFlowLayout(this);
   fl->Parent = myForm;
   fl->Align = TAlignLayout::Client;
   for(int i = 1, i < 6, i++)
   {
      TRectangle *rect = new TRectangle(fl);
      rect->Parent = fl;
      rect->Margins = TBounds(TRectF(10,10,10,10));
      rect->Fill->Stroke = .....
      ....styling

      TImage *img = new TImage(rect);
      img->Parent = rect;
      img->Bitmap->LoadFromFile(....);
      rect->Parent = fl;
   }


This would then add each rectangle to the flow layout which would in this case be the size of the form.
jayden
Active Poster
Active Poster
 
Posts: 24
Joined: Fri Aug 21, 2015 3:41 pm


Return to Technical

Who is online

Users browsing this forum: No registered users and 6 guests

cron