Garry's Mod Wiki

Panel:SizeToContents

  Panel:SizeToContents()

Description

Resizes the panel so that its width and height fit all of the content inside.

Only works on Label derived panels such as DLabel by default, and on any panel that manually implemented the Panel:SizeToContents method, such as DNumberWang and DImage.
You must call this function AFTER setting text/font, adjusting child panels or otherwise altering the panel.