首页 > 代码库 > [改善] dcef3 for Firemonkey 浏览器控件,拉动窗体大小会闪烁的问题

[改善] dcef3 for Firemonkey 浏览器控件,拉动窗体大小会闪烁的问题

问题:dcef3 for Firemonkey 浏览器控件,拉动窗体大小会闪烁的问题

修改源码:ceffmx.pas

找到 procedure TCustomChromiumFMX.Resize;

修改如下:

procedure TCustomChromiumFMX.Resize;
var
  brws: ICefBrowser;
  b: TBitmap;
begin
  inherited;
  if not (csDesigning in ComponentState) then
  begin
    brws := FBrowser;
    if (brws <> nil) then
    begin
      if FBuffer = nil then
        FBuffer := TBitmap.Create(Trunc(Width), Trunc(Height)) else
      begin
        b := TBitmap.Create;
        b.Assign(FBuffer);
        FBuffer.SetSize(Trunc(Width), Trunc(Height));
        FBuffer.Canvas.BeginScene;
        FBuffer.Canvas.DrawBitmap(B, RectF(0, 0, b.Width, b.Height), RectF(0, 0, b.Width, b.Height), 1, True);
        FBuffer.Canvas.EndScene;
        b.Free;
      end;
      brws.Host.WasResized;
    end;
  end;
end;

 

Delphi Chromium Embeded 3:https://github.com/hgourvest/dcef3

注:dcef3 FMX 用 Bitmap 处理,效能不如 VCL 的好,还是建议使用 VCL

[改善] dcef3 for Firemonkey 浏览器控件,拉动窗体大小会闪烁的问题