禁用 TWebBrowser 的滚动可能性
Disable scrolling possibility of TWebBrowser
有谁知道如何在 Firemonkey iOS / Android 应用程序中禁用 TWebBrowser
控件的滚动可能性?我的目标是获得不会对触摸等做出反应的绝对静态元素。
没有单一的设置或操作可以禁用 Fmx.TWebBrowser
的所有用户操作。但是有一个功能可以用于您的目的。
我指的特征是Fmx.WebBrowser.TCustomWebBrowser.CaptureBitmap
documented here
Description
Captures the currently visible Web page as a bitmap.
This method returns a TBitmap object, which allows you to create,
manipulate and store images in memory or as files on a disk. The
scenario of the use of this method could be as follows:
1. Call this method to capture a visible Web page as a bitmap.
2. Hide a TWebBrowser control.
3. Display the bitmap and overlay other components (such as buttons or popups) on top of the bitmap.
在您的情况下,您只需隐藏 WB 并显示位图。
使用以下代码测试:
type
TForm25 = class(TForm)
Button1: TButton;
WebBrowser1: TWebBrowser;
Edit1: TEdit;
Image1: TImage;
Timer1: TTimer;
procedure Button1Click(Sender: TObject);
procedure WebBrowser1DidFinishLoad(ASender: TObject);
procedure Timer1Timer(Sender: TObject);
private
{ Private declarations }
bmp: TBitmap;
public
{ Public declarations }
end;
implementation
procedure TForm25.Button1Click(Sender: TObject);
begin
WebBrowser1.URL := Edit1.Text;
end;
procedure TForm25.Timer1Timer(Sender: TObject);
begin
bmp := WebBrowser1.CaptureBitmap;
Image1.Bitmap := bmp;
end;
procedure TForm25.WebBrowser1DidFinishLoad(ASender: TObject);
begin
Timer1.Enabled := True;
end;
隐藏了WB,无法操作
我添加的计时器(1000 毫秒)是因为我尝试捕捉已经在 OnDidFinishLoad()
事件中的图像没有成功。
有谁知道如何在 Firemonkey iOS / Android 应用程序中禁用 TWebBrowser
控件的滚动可能性?我的目标是获得不会对触摸等做出反应的绝对静态元素。
没有单一的设置或操作可以禁用 Fmx.TWebBrowser
的所有用户操作。但是有一个功能可以用于您的目的。
我指的特征是Fmx.WebBrowser.TCustomWebBrowser.CaptureBitmap
documented here
Description
Captures the currently visible Web page as a bitmap.
This method returns a TBitmap object, which allows you to create, manipulate and store images in memory or as files on a disk. The scenario of the use of this method could be as follows: 1. Call this method to capture a visible Web page as a bitmap. 2. Hide a TWebBrowser control. 3. Display the bitmap and overlay other components (such as buttons or popups) on top of the bitmap.
在您的情况下,您只需隐藏 WB 并显示位图。
使用以下代码测试:
type
TForm25 = class(TForm)
Button1: TButton;
WebBrowser1: TWebBrowser;
Edit1: TEdit;
Image1: TImage;
Timer1: TTimer;
procedure Button1Click(Sender: TObject);
procedure WebBrowser1DidFinishLoad(ASender: TObject);
procedure Timer1Timer(Sender: TObject);
private
{ Private declarations }
bmp: TBitmap;
public
{ Public declarations }
end;
implementation
procedure TForm25.Button1Click(Sender: TObject);
begin
WebBrowser1.URL := Edit1.Text;
end;
procedure TForm25.Timer1Timer(Sender: TObject);
begin
bmp := WebBrowser1.CaptureBitmap;
Image1.Bitmap := bmp;
end;
procedure TForm25.WebBrowser1DidFinishLoad(ASender: TObject);
begin
Timer1.Enabled := True;
end;
隐藏了WB,无法操作
我添加的计时器(1000 毫秒)是因为我尝试捕捉已经在 OnDidFinishLoad()
事件中的图像没有成功。