|

楼主 |
发表于 2009-4-20 13:55:42
|
显示全部楼层
procedure TArchivsFromExist.SaveSheetPicToStream(ASheetName,ASheetURL: string;AList: TStringList);
var
lBitMap: TBitMap;
lJPG: TJPEGImage;
lWidth,lHeight: Integer;
lSheet: TSheetDoc;
lDocID: string;
lPaperView: TPaperPreView;
lNextbtn: TSpeedButton;
I:Integer;
begin
I := 1;
try
lDocID := SysUtils.UpperCase(ASheetURL);
jsCommon.splitStr(SysUtils.UpperCase(FInfoURL)+'\',lDocID);
FForm.DocView.DocClassID := lDocID;
lSheet := FForm.DocView.Doc as TSheetDoc;
lPaperView := TWinControl(TWinControl(TWinControl(FForm.DocView.Controls[0]).Controls[0]).Controls[2]).Controls[0] as TPaperPreView;
FForm.DocView.Width := lPaperView.Width;
FForm.DocView.Height := lPaperView.Height;
//Borland.Delphi.Windows.SendMessage(FForm.Handle,Borland.Delphi.Messages.WM_SHOWWINDOW,0,0);
//FForm.DocView.RefreshDoc(True);
[问题在这里,如何在Form不SHow的情况下,DocVIew(模式为PreVIew)依然加载输出图片,上面两行代码试过不行]
lBitMap := TBitMap.Create;
lJPG := TJPEGIMage.Create;
lBitMap.Width := lPaperView.PaperWidth;
lBitMap.Height := lPaperView.PaperHeight;
lBitMap.PixelFormat:=TPixelFormat.pfDevice;
lPaperView.PaintTo(lBitMap.Canvas,0,0);
lJPG.Assign(lBitMap);
finally
lBitMap.Free;
end; |
|