che cosa è sbagliato nel seguente codice?
codice:
var
DC : HDC; DestBitmap,DestBitmap2: TBitmap; Res:TBytes; SSS:TMEMORYSTREAM;
begin
DC := GetDC (GetDesktopWindow) ;
DestBitmap:=TBitmap.Create;
DestBitmap2:=TBitmap.Create;
SSS := TMEMORYSTREAM.Create;
try
DestBitmap.Width := GetDeviceCaps (DC, HORZRES) ;
DestBitmap.Height := GetDeviceCaps (DC, VERTRES) ;
BitBlt(DestBitmap.Canvas.Handle,0,0,DestBitmap.Width,DestBitmap.Height,DC,0,0,RCCOPY) ;
finally
ReleaseDC (GetDesktopWindow, DC) ;
end;
DestBitmap2:=ResizeBMP(Destbitmap,strtoint(form5.edit1.text));
Destbitmap2.SaveToStream(SSS);
Destbitmap.LoadFromStream(sss);
Form5.IMG.Picture.Bitmap:=destbitmap2; //questo funziona
Form5.IMG.Picture.bitmap:=destbitmap; //questo non funziona
end;
come mai salvando sullo stream perdo l'immagine??