在Windows窗体WebBrowser中更改html元素的位置 [英] Changing the position of html elements in Windows Forms WebBrowser
问题描述
是否可以在Windows窗体WebBrowser控件中更改一个html元素的位置?我已经有了:
pre $ public partial class Form1:Form
{
public Form1()
{
InitializeComponent();
}
private void webBrowser1_DocumentCompleted(object sender,WebBrowserDocumentCompletedEventArgs e)
{
webBrowser1.Document.GetElementById(gpu_notice)。Style =display:none ;
webBrowser1.Document.GetElementById(header)。OuterHtml =;
webBrowser1.Document.GetElementById(ads)。OuterHtml =;
//在这里移动元素the_game
}
}
}
下一步将移动一个元素...
您可以通过添加 position
属性为样式
就像这样。
var game = webBrowser1.Document.GetElementById(the_game);
game.Style + =position:absolute; top:50px; right:20px;;
我会推荐阅读这个,并得到如何使用它。
Is it possible to change the position of one html element in the Windows Forms WebBrowser Control? I already have this:
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
webBrowser1.Document.GetElementById("gpu_notice").Style = "display:none";
webBrowser1.Document.GetElementById("header").OuterHtml = "";
webBrowser1.Document.GetElementById("ads").OuterHtml = "";
// move element "the_game" here
}
}
}
The next step would be moving an element...
You can move the_game element by adding position
property to Style
like this.
var game = webBrowser1.Document.GetElementById("the_game");
game.Style += "position: absolute; top: 50px; right: 20px;";
I would recomend to read this and get how to use this.
这篇关于在Windows窗体WebBrowser中更改html元素的位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!