[SOLVED] Problem changing thumbnail size in ThumbViewer component lazarus / 39-Graphics ---------------------------------------------------------------------- madepabloh · 2021-05-19 09:32 Hi there, I have an issue with Thumbviwer component. I habe a thumbcontrol where i load images form a directory. The layout is set to LsGrid and Autosizeoption = true. Thumbs heights and widths are set to 100 by default. I added a trackbar with max and min set to 1 and 5 respectively. The idea is to allow the user to change the thumbnails size on runtime. To do it. i use this code: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i Thumbcontrol1.ThumbWidth := 100*Trackbar1.position;Thumbcontrol1.ThumbWidth := 100*Trackbar1.position;  It works partially. The image frame changes properly, adjusting the imageframe and its caption, but the image itself does not change at all, keeping the original size. I tried adding different commands to the procedure: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i Thumbcontrol1.Repaint;Thumbcontrol1.Update;Thumbcontrol1.Refresh;  But nothings results on the correct resizing of the picture, as it works when changing the thumbcontrol size. In fact, i also tried to change the control size, to see if it works as it should be, by this code: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i Thumbcontrol1.Width := Thumbcontrol1.Width +1;Thumbcontrol1.Width := Thumbcontrol1.Width - 1; Again without results. Do you have idea how could i solve this issue? Thanks! ---------------------------------------------------------------------- wp · 2021-05-19 13:06 Which ThumbViewer is this? Theo's Thumbviewer (https://github.com/theo222/lazarus-thumbviewer)? In this case you must first set the new thumbnail size, then erase the cached thumbnail images (ThumbControl1.ImageLoaderManager.FreeImages) and finally reload the images which creates new thumbnails (ThumbControl.ImageLoaderManager.LoadAll). This works in my test. ---------------------------------------------------------------------- madepabloh · 2021-05-19 14:45 Thanks @wp. Yes, it is. The Theo's Thumbviewer (https://github.com/theo222/lazarus-thumbviewer). I changed my code to fit your recomendation and it works perfectly!! Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i Thumbcontrol1.ThumbHeight := 100 * Trackbar1.Position;Thumbcontrol1.ThumbWidth := 100 * Trackbar1.Position; ThumbControl1.ImageLoaderManager.FreeImages; Thumb Control1.ImageLoaderManager.LoadAll;  So, SOLVED. Thanks so much @wp