WebBrowser加上进度条
源文件 view code
using system;
using system.collections.generic;
using system.componentmodel;
using system.data;
using system.drawing;
using system.linq;
using system.text;
using system.windows.forms;
namespace windowsformsapplication1
{
public partial class webbrowserprogressbar : form
{
public webbrowserprogressbar()
{
initializecomponent();
}
//初始from
private void webbrowserprogressbar_load(object sender, eventargs e)
{
progressbar1.visible = false;
}
//加载进度条
private void webbrowser1_progresschanged(object sender, webbrowserprogresschangedeventargs e)
{
progressbar1.visible = true;
if ((e.currentprogress > 0) && (e.maximumprogress > 0))
{
progressbar1.maximum = convert.toint32(e.maximumprogress);
progressbar1.step = convert.toint32(e.currentprogress);
progressbar1.performstep();
}
else if (webbrowser1.readystate == webbrowserreadystate.complete)
{
progressbar1.value = 0;
progressbar1.visible = false;
}
}
//跳转
private void btngo_click(object sender, eventargs e)
{
if (!string.isnullorempty(textbox1.text))
{
webbrowser1.navigate(textbox1.text);
}
}
}
摘自 loafinweb
下一篇: Mac版webstorm
推荐阅读