::
Ho risolto senza usare il tcolorbox e usando solo il listing impostato nel seguente modo:
`
\DeclareCaptionFont{white}{\color{white}}
\DeclareCaptionFormat{listing}{%
\parbox{\textwidth}{\colorbox{gray}{\parbox{\textwidth}{#1#2#3}}\vskip-25pt}}
\captionsetup[lstlisting]{format=listing,labelfont=white,textfont=white}
\lstset{frame=lrtb,xleftmargin=1.6\fboxsep,xrightmargin=-0.3\fboxsep, belowcaptionskip=1\baselineskip, breaklines=true, showstringspaces=false, basicstyle=\footnotesize\ttfamily, language=C, numbers=left, numberstyle=\small, rulecolor=\color{gray}, framerule=2pt, backgroundcolor=\color[gray]{0.949}}
`
L’aspetto è identico.