How to draw a ScrollBar on TCanvas? lazarus / 31-LCL ---------------------------------------------------------------------- Edson · 2014-09-17 20:18 In resume, I have some graphic objects that I draw using the TCanvas and I can correctly control the selection, resizing and movement. Now I need to include a functional ScrolBar on these objects.  I know I can draw all of it with graphic methods, and control the mouse events for to make it works. But I would like to know if there is a simpler way or if there is some graphic library that make it easy. ---------------------------------------------------------------------- Never · 2014-09-17 20:36 TScrollBar doesn't fit your needs? ---------------------------------------------------------------------- Edson · 2014-09-17 20:49 Quote from: Never on September 17, 2014, 10:36:05 pmTScrollBar doesn't fit your needs? My Objects are dinamically created and draw directly on the Canvas. They are not controls or containers for controls. I know I can create a new TScrollBar for each or my objects and move and resize him when it needs. But I'm not sure if it is good mixing controls with drawing on Canvas. Moreover, my objects accept Zoom in and Zoom Out, so I will probably need some scrollbar with accept zoom. ---------------------------------------------------------------------- Blaazen · 2014-09-17 21:05 Maybe it is possible via Themes. Use these details: Code: [Select]// 'ScrollBar' theme data   TThemedScrollBar = (     tsScrollBarDontCare,     tsScrollBarRoot,     tsArrowBtnUpNormal, tsArrowBtnUpHot, tsArrowBtnUpPressed, tsArrowBtnUpDisabled,  ...If you have luck, you will paint whole scrollbar this way. However, I still think you should rather use normal scrollbars. Rather than TScrollBar, use the built-in scroll bars, see this: https://github.com/theo222/lazarus- thumbviewer/blob/master/scrollingcontrol.pas ---------------------------------------------------------------------- Edson · 2014-09-17 21:37 Thanks for the responses. Quote from: Blaazen on September 17, 2014, 11:05:22 pmMaybe it is possible via Themes. Use these details: Is there some example of using TThemedScrollBar ?. I can't find anything. Quote from: Blaazen on September 17, 2014, 11:05:22 pmHowever, I still think you should rather use normal scrollbars. I had a bad experience using Normal Controls with drawing on Canvas, with VB. I can remember this obstacles: * They are slow for drawing. I need to refresh several times all the screen. * They don't support zoom (FAIK). * They are asociated with a control container not with any object. * They draw always in front of the Canvas. It's not easy to draw over a control, hiding the control partially. In fact I need buttons, checkbox and scrollbar for using on canvas. Probably I will  have to write a little widget library for my App. ---------------------------------------------------------------------- Never · 2014-09-17 22:21 QuoteIs there some example of using TThemedScrollBar ?. I can't find anything. found this [http://sourceforge.net/p/jvcl/mailman/jvcl- checkins/?viewmonth=201209] ---------------------------------------------------------------------- Edson · 2014-09-18 02:03 Thanks I will check.