微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

delphi – 如何清除jpeg图像?

如何清除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;

原文地址:https://www.jb51.cc/delphi/101637.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐