WBCount:Integer;
web:array[0..100] of TWebBrowser;
wb:TWebBrowser; tab:TTabSheet;
建立时
tab:=TTabSheet.Create(Self);//tab为我建立的新页
tab.PageControl:=PageControl1;
tab.Align:=alClient;
tab.Tag:=WBCount;//wbcount为数组控件现在的使用的个数
wb:=TWebBrowser.CreateParented(Self.ParentWindow);//wb为TwebBrowser
tab.InsertControl(wb);
wb.Tag:=WBCount;
wb.Align:=alClient;
ppdisp:=wb.DefaultDispatch;
wb.OnDownloadBegin:=WebBrowser1.OnDownloadBegin;
wb.OnDownloadComplete:=WebBrowser1.OnDownloadComplete;
wb.OnNewWindow2:=WebBrowser1.OnNewWindow2;
wb.OnProgressChange:=WebBrowser1.OnProgressChange;
wb.OnTitleChange:=WebBrowser1.OnTitleChange;
web[WBCount]:=wb;
isover[WBCount]:=False;
PageControl1.ActivePage:=tab;
Form1.Caption:=inttostr(WBCount);
WBCount:=WBCount+1;
释放时
if Assigned(PageControl1.Pages[n]) then
PageControl1.Pages[n].Free;
web[n]:=nil;//n为要释放的控件的下标