TScrollBox scrollby without scrollbars lazarus / 31-LCL ---------------------------------------------------------------------- martinrame · 2012-04-07 00:31 Hi, I have a TScrollbox containing many TPanels that I can move by dragging the scrollbars, also I can call the method scrollBy to do the same. Now I want to hide the scrollbars, and scroll the contents by calling scrollby. Is this possible?. If I set AutoScroll to False, the scrollbars aren't shown, but when I call scrollby there's no scrolling at all. ---------------------------------------------------------------------- User137 · 2012-04-07 08:56 I have just a weird idea: Have 2 TPanels make a "scrollbox". 1 panel is placed inside other, and then all your components are drawn on the panel that is inside that panel. Now moving the panel inside will move your components along with it, and they will only render parts that are inside the outer panel. ---------------------------------------------------------------------- martinrame · 2012-04-07 12:36 Thanks User137, it worked. Here's my proof of concept based on your idea: Just create two panels, one taller than the other. Then place the tallest one inside the other. Here's the code. Code: [Select]unit Unit1; {$mode objfpc}{$H+} interface uses   Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ExtCtrls,   StdCtrls; type   { TForm1 }   TForm1 = class(TForm)     Button1: TButton;     Button2: TButton;     Label1: TLabel;     Label10: TLabel;     Label2: TLabel;     Label3: TLabel;     Label4: TLabel;     Label5: TLabel;     Label6: TLabel;     Label7: TLabel;     Label8: TLabel;     Label9: TLabel;     Panel1: TPanel;     Panel2: TPanel;     procedure Button1Click(Sender: TObject);     procedure Button2Click(Sender: TObject);   private     { private declarations }   public     { public declarations }   end; var   Form1: TForm1; implementation {$R *.lfm} { TForm1 } procedure TForm1.Button1Click(Sender: TObject); begin   Panel2.Top := Panel2.Top + 10;   if (Panel2.Top) > 0 then     Panel2.Top := 0; end; procedure TForm1.Button2Click(Sender: TObject); var   lBottom: Integer;   lMax: Integer; begin   Panel2.Top := Panel2.Top - 10;   lBottom := Panel2.Top + Panel2.Height;   lMax := Panel1.Height;   if lBottom < lMax then     Panel2.Top := Panel1.Height - Panel2.Height;   Label9.Caption:= Format('Bottom: %d - Top: %d', [lBottom, Panel2.Top]);   Label10.Caption:= Format('Max bottom: %d', [lMax]); end; end.