我在德尔福 XE3 工作。我制作了一个循环,它通过一个带有 6 个选项卡的 Pagecontrol,它的框架带有很多加载 mdb 数据的编辑框。
循环浏览页面时,我制作了活动选项卡的“截屏”图像并将其放置在 fastreport 中的图像上。
一切都很好,但是在一些速度较慢的计算机上进行测试时,它会生成所有帧,但尚未加载数据。在转到下一页之前,如何检查所有数据是否已加载到放置在选项卡上的框架编辑组件中?
代码如下所示:
begin
Screen.Cursor := crHourGlass;
p := PageControlKalkyl.ActivePageIndex; // Get page index
for i := 0 to 7 do begin
MyPage := frxReport1.FindObject('Page' + IntToStr(i)) as TfrxPage;
MyPage.Visible := True;
end;
try
for i := 0 to PageControlKalkyl.PageCount - 1 do
If PageControlKalkyl.Pages[i].TabVisible then
Begin
PageControlKalkyl.ActivePageIndex := i;
PageControlKalkyl.ActivePage.Repaint;
Bilder := 'Pic' + IntToStr(i);
if FLaddardata = False then //Check if page changed
Try
Bitmap := TBitmap.Create;
Assert(HandleAllocated);
DC := GetWindowDC(Handle);
Win32Check(DC <> 0);
Bitmap.SetSize(Width, Height);
Win32Check(BitBlt(Bitmap.Canvas.Handle, 0, 0, Width, Height, DC, 0, 0, SRCCOPY));
//Load data in to Images in Fastreport
if PageControlKalkyl.ActivePageIndex > 0 then
Begin
Ver:= 'Version NR: ' + Trim(DataModuleTrakop.ADOTableKALKYL.FieldByName('VERSION').AsString);
Raid:= 'Kalkyl ID: ' + Trim(DataModuleTrakop.ADOTableKALKYL.FieldByName('DENH').AsString);
RepImage := frxReport1.FindObject('Pic'+IntTostr(i)) as TfrxPictureView;
RepImage.Picture.Assign(Bitmap);
Rappid := frxReport1.FindObject('Rapdata' + IntToStr(i)) as TfrxMemoView;
Rappid.Font.Style:= [fsBold];
Rappid.Text := Ver +' '+Raid;
end;
Finally
ReleaseDC(Handle, DC);
Bitmap.Free;
End;
end
else
begin
MyPage := frxReport1.FindObject('Page' + IntToStr(i)) as TfrxPage;
MyPage.Visible := False;
end;
if Fskaparapport = True then
begin
Fskaparapport := False;
frxReport1.PrepareReport;
if FEpost = False then
frxReport1.ShowPreparedReport;
Screen.Cursor := crDefault;
end;
PageControlKalkyl.ActivePageIndex := p;
except
on E: Exception do
ShowMessage(E.Message);
end;
end;