Resize Control at Runtime lazarus / 32-Linux ---------------------------------------------------------------------- local-vision · 2021-01-29 22:12 Resize a control, such as a TPanel, at runtime? Preferably you would want a selection/bounding box of some kind to appear around the control and by dragging on any of its nodes resize the control. The examples I find use 3rd party libraries/components and/or are all for Windows API (have not used ms win in years), I use linux. Any Linux examples out there?... ...much appreciated ---------------------------------------------------------------------- dbannon · 2021-01-30 06:19 Hmm, you want to resize a control without changing the size of its containing window ?  The normal approach is to have the control ultimately anchored to the sides of its windows so that the user can grab the window, resize it and have the control resize accordingly. Or, to have the control anchored to a TSplitter, the user can then grap the splitter and resize the control. Or do it programmatically, its easy to do something like 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 MyControl.Width := MyControl.Width + 10 every time ButtonBigger is pressed. Davo ---------------------------------------------------------------------- local-vision · 2021-01-31 03:56 Hi dbannon, Many thanks for your response.  I had in mind something a bit more radical. One that resembles the design time size and position manipulations of controls. I believe I found what I am looking for and am placing the code here for others. 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 unit Unit1; // About: Resize or reposition a control at runtime {$mode objfpc}{$H+} interface uses  Classes, SysUtils, Forms, Controls, Graphics, Dialogs, ExtCtrls; type   { TForm1 }   TForm1 = class(TForm)    Panel1: TPanel;    procedure Panel1MouseDown(Sender: TObject; Button: TMouseButton;      Shift: TShiftState; X, Y: Integer);    procedure Panel1MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer      );    procedure Panel1MouseUp(Sender: TObject; Button: TMouseButton;      Shift: TShiftState; X, Y: Integer);  private   public   end; var  Form1: TForm1; implementation {$R *.lfm} { TForm1 } const    GripSize=9; // sets the area size of the corner to drag type     TMousePositionMessage               =class(TControl);// need to follow the mouse even when outside the control area var      xPositionMouseDown,         yPositionMouseDown                  :Integer;         MouseIsDragging                     :Boolean;       MouseIsDraggingCorner               :Boolean; procedure TForm1.Panel1MouseDown(Sender: TObject; Button: TMouseButton;Shift: TShiftState; X, Y: Integer);begin  xPositionMouseDown := X;  yPositionMouseDown := Y;  MouseIsDragging := True;   //if mouse down position is within grip area of panel (south west corner)  if (y>Panel1.Height-GripSize) and (x>Panel1.Width-GripSize) then  begin  MouseIsDraggingCorner:=True;  end;   TMousePositionMessage(Sender).MouseCapture := True;end;  procedure TForm1.Panel1MouseMove(Sender: TObject; Shift: TShiftState; X,Y: Integer);begin  Form1.Caption:=IntToStr(X)+'|'+IntToStr(Y);   if (MouseIsDragging) and not(MouseIsDraggingCorner) then  begin    with Sender as TControl do    begin      Panel1.Left := X - xPositionMouseDown + Panel1.Left;      Panel1.Top  := Y - yPositionMouseDown + Panel1.Top;    end;  end;   if (Y>Panel1.Height- GripSize) and (X>Panel1.Width-GripSize) then  begin    Panel1.Cursor := crSizeSE;  end else  begin    Panel1.Cursor := crdefault;  end;   if MouseIsDraggingCorner then  begin    with Sender as TControl do    begin      Panel1.Height  := Y;      Panel1.Width  := X;    end;  end; end; procedure TForm1.Panel1MouseUp(Sender: TObject; Button: TMouseButton;  Shift: TShiftState; X, Y: Integer);begin  if MouseIsDragging then  begin    MouseIsDraggingCorner:=False;    MouseIsDragging := False;    TMousePositionMessage(Sender).MouseCapture := False;  end;end; end.