如何清除TJPEG
Image图像?
JPG.Width:= 0技巧不起作用.
另外,我不想创建一个空位图(0x0像素)并将其分配给jpeg.
解决方法
你可以使用这样的东西(这里使用插入的类来访问受保护的方法):
type TJPEGImage = class(jpeg.TJPEGImage); implementation procedure TForm1.Button1Click(Sender: TObject); var JPEGImage: TJPEGImage; begin JPEGImage := TJPEGImage.Create; try // this should recreate the internal bitmap JPEGImage.NewBitmap; // this should recreate the internal image stream JPEGImage.NewImage; // here the memory used by the image should be released finally JPEGImage.Free; end; end;