从 Web 浏览器对象中删除滚动条和边框

发布于 2024-12-25 12:11:28 字数 313 浏览 1 评论 0原文

我有一个使用网络浏览器对象的幻灯片。问题在于,Web 浏览器对象上的滚动条始终存在,无论是否需要它们。有什么办法可以去掉滚动条吗?

我尝试添加:

WebBrowser.Document.body.Scroll = "no"

但这会使对象停止一起工作。

此外,该物体周围有一个薄薄的浅色边框(我认为它是白色的,但很难分辨)。由于我的大部分演示文稿都是黑色的,因此尽管我已将显示的 html 的背景颜色设置为黑色,但它并不能很好地融合。有没有办法也摆脱边界?

如果用 VBA 无法完成,是否可以完成?

I have a powerpoint that is using a web browser object. The trouble is that the scrollbars on the web browser object are always there, regardless of whether or not they are needed. Is there some way to remove the scroll bars?

I have tried adding:

WebBrowser.Document.body.Scroll = "no"

but that makes the object stop working all together.

Also, the object has a thin light colored (i think it is white but it is hard to tell) border around it. Since most of my presentation is black this does not blend well though i have set the background color of the html displayed to be black. Is there a way to get rid of the border as well?

if they cannot be done with vba can they be done at all?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

饮湿 2025-01-01 12:11:29

吉米佩纳,

我做到了。经过一些测试后,我发现如果我将图像设置为 webbrowser 并尝试在同一“f5”执行中设置其他 Document.Body 属性,则不起作用。

讽刺的是,如果你尝试使用“f8”,它就会起作用。

我认为这是因为 webbrowser 组件在加载对象后无法设置某些属性。

Sooooo,我尝试制作一个 HTML 文件,其中设置了我的对象(在我的例子中是 gif 图像),并设置了所有属性,包括滚动删除、边距删除和边框删除。

你可以在下面看到我的代码。

HTML (test.html):

<html>
<head>
</head>

<body style="overflow: hidden; margin: 0; border: 0;">
    <img src="Assets/loading-small.gif" />
</body>
</html>

VBA:

Sub abaSV_showLoadingIcon()
    AbaSV.WebBrowser1.Visible = True

    AbaSV.WebBrowser1.Navigate ThisWorkbook.path & "\test.html"
End Sub

我认为这应该对您有所帮助,JimmyPena 和unknowntea。

再见!

JimmyPena,

I did it. After some tests I discovered that if I set the image to webbrowser and try to set other Document.Body properties in the same "f5" execution it didn't work.

If you try to use "f8", it works, ironically.

I think it is because that webbrowser component cannot set some properties after loading an object.

Sooooo, i tried to make an HTML file in which my object (in my case, an gif image) was set and all properties was set as well, including scroll removal, margin removal and border removal.

You can see my codes below.

HTML (test.html):

<html>
<head>
</head>

<body style="overflow: hidden; margin: 0; border: 0;">
    <img src="Assets/loading-small.gif" />
</body>
</html>

VBA:

Sub abaSV_showLoadingIcon()
    AbaSV.WebBrowser1.Visible = True

    AbaSV.WebBrowser1.Navigate ThisWorkbook.path & "\test.html"
End Sub

I think that should help you, JimmyPena and uncertaintea.

SeeYa!

七分※倦醒 2025-01-01 12:11:29

除了 VBA 部分之外,你的想法运行得很好。

所以我所做的就是像你一样创建一个 html 文件,分配属性并调用 gif 图像。

然后在 VBA 中我使用了以下代码(在可以找到 webborser 的工作表中):

Private Sub worksheet_activate()
WebBrowser1.Navigate "insert html file path.html"
End Sub

Your idea works just fine, except for the VBA part.

So what I did is to creat a html file as you did, assigning the properties and calling the gif image.

Then in VBA i used the following code (in the sheet where the webborser can be found):

Private Sub worksheet_activate()
WebBrowser1.Navigate "insert html file path.html"
End Sub
浮生面具三千个 2025-01-01 12:11:29

我通过在 html 文件中的 标签下应用此代码解决了这个问题:

<style type="text/css">
html {
overflow:hidden;
}
</style>

I solved this by applying in the html file this code under the <head> tag:

<style type="text/css">
html {
overflow:hidden;
}
</style>
终难遇 2025-01-01 12:11:29

使用 Document.Body.Scroll = "No" 禁用 Web 浏览器中的滚动条

Option  Explicit 
Private Sub
UserForm_Activate()
WebBrowser1.Navigate "C:-Download-P.gif"
End Sub

Private Sub 
WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant)
With WebBrowser1
. Width = 80 
. Height = 80 
. Document.Body.Scroll = "No"
End With
End Sub

Use Document.Body.Scroll = "No" to disable scroll bar in Webbrowser

Option  Explicit 
Private Sub
UserForm_Activate()
WebBrowser1.Navigate "C:-Download-P.gif"
End Sub

Private Sub 
WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant)
With WebBrowser1
. Width = 80 
. Height = 80 
. Document.Body.Scroll = "No"
End With
End Sub
转瞬即逝 2025-01-01 12:11:28

我的理解是不,这是不可能的。我不喜欢滚动条,但它是 IE 的一部分,我看不到任何方法可以在不完全禁用功能的情况下删除它,正如您已经看到的那样。

My understanding is no, this is not possible. I dislike the scroll bar, but it's a part of IE and I don't see any way to remove it without completely disabling functionality as you have already seen.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文