Durch nen kleinen Hack kannst du das Verhalten deiner TListBox noch verändern:
Delphi-Quellcode:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TListBox =
class(StdCtrls.TListBox)
protected
procedure CreateParams(
var Params: TCreateParams);
override;
end;
type
TForm1 =
class(TForm)
ListBox1: TListBox;
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
ListBox1.Items.add('
asfkljhasuilfhfuih fuihawiuh waeuifhw');
end;
{ TListBox }
procedure TListBox.CreateParams(
var Params: TCreateParams);
begin
inherited CreateParams(Params);
if (Params.Style
and WS_VSCROLL) <> 0
then
Params.Style := Params.Style
and not WS_VSCROLL;
end;
end.
Außerdem ist die Methode CreateParams besser als die oben vorgeschlagene.