无特殊修改,仅把WebBrowser的Position.x属性与Layout_sidemenu控件显示隐藏相关的命令相结合
菜单显示的时候修改WebBrowser.Position.x的值让WebBrowser控件避开菜单被覆盖的那一部分。这就能避开网页覆盖掉菜单的问题。
问题至此解决。
完美解决还是等官方出补丁吧
procedure TForm1.Button2Click(Sender: TObject);
begin
if Button2.Text = '打开菜单' then
begin
Button2.Text := '隐藏菜单';
Layout_sidemenu.Visible := true;
WebBrowser1.Position.x :=210;
end
else
begin
Button2.Text := '打开菜单';
Layout_sidemenu.Visible := false;
WebBrowser1.Position.x :=0;
end
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
WebBrowser1.URL:='http://www.hintmag.cn/336/index.html';
end;
procedure TForm1.FormKeyUp(Sender: TObject; var Key: Word; var KeyChar: Char;
Shift: TShiftState);
begin
if (Key = vkHardwareBack) or (Key = vkMenu) then
begin
if Layout_sidemenu.Visible = true then
begin
Layout_sidemenu.Visible := false; // 隐藏菜单
WebBrowser1.Position.x :=0;
Key := 0;
exit;
end
else
begin
Layout_sidemenu.Visible := true; // 显示菜单
WebBrowser1.Position.x :=210;
Key := 0;
exit;
end;
end;
end;
© 版权声明
文章版权归作者所有,未经允许请勿转载。