以下示範了如何將 ListBox 加入水平捲軸: procedure TForm1.FormCreate(Sender: TObject); var i, MaxWidth: integer; begin MaxWidth := 0; for i := 0 to ListBox1.Items.Count - 1 do begin if (MaxWidth < ListBox1.Canvas.TextWidth(ListBox1.Items.Strings[i])) then MaxWidth := ListBox1.Canvas.TextWidth(ListBox1.Items.Strings[i]); end; MaxWidth := (MaxWidth * 3) div 2; SendMessage(ListBox1.Handle, LB_SETHORIZONTALEXTENT, MaxWidth, 0); end;