Click here to Skip to main content
15,039,149 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
hi
I am using listview with images to display images, now i want to trackbar to increase or reduce the size of images in listview,

C#
private void trackBar1_Scroll(object sender, EventArgs e)
      {
          setZoom();
      }

      private void setZoom()
      {
          int newZoom = zoomFactor[zoomBar.Value];
          imageList1.ImageSize = new System.Drawing.Size(newZoom, newZoom);

          listView1.LargeImageList = imageList1;

}

i m using this for increasing the size of image
its work but the thumbnail get changes.
Posted
Updated 26-Jan-12 18:19pm
v3
Comments
Erik Rude 26-Jan-12 7:20am
   
Help yourself by stating whether this is WinForms or WPF or something else.
Sumit Memane 26-Jan-12 7:22am
   
WinForms
Sergey Alexandrovich Kryukov 26-Jan-12 14:20pm
   
Please tag it. You are the one who is the most interested in that. Use "Improve question".
--SA

You can have an image which is big enough (in pixels) and scale it down to required size. This is not a trivial procedure called re-sampling.

This is the recipe on how to do it:
http://stackoverflow.com/questions/249587/high-quality-image-scaling-c-sharp[^].

Generally, you can re-sample the image with decent quality if you scale it down, not up. I would recommend you to avoid the possibility of scaling it up; or allow some re-sampling up, not very moderate, otherwise it will look really ugly.

—SA
   
Comments
Espen Harlinn 26-Jan-12 17:13pm
   
5'ed!
Sergey Alexandrovich Kryukov 26-Jan-12 17:18pm
   
Thank you, Espen.
--SA
Sumit Memane 27-Jan-12 3:56am
   
Hello
bt i want to do it using listview and trackbar
Can you help me write the function zoomFactor?
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900