procedure TForm5.FormCreate(Sender: TObject);
begin
//**********
ListBox1:=TListBox.Create(self);
ListBox1.Parent:=self;
ListBox1.Left:=100;
ListBox1.Top:=100;
ListBox1.Width:=400;
ListBox1.Height:=400;
ListBox1.Style:=lbOwnerDrawVariable;
ListBox1.ItemHeight:=100;
ListBox1.AddItem('123',self);
end;
procedure TForm5.FormDestroy(Sender: TObject);
begin
//*************
//ListBox1.Style:=lbStandard;//
ListBox1.Free;
end;
出现Exception class EAccessViolation with message 'Access violation at address 7C93B1FA in module 'ntdll.dll'.问题??
解决方案:
在free之前,还原风格,ListBox1.Style:=lbStandard;
OK!!!