The progress is displayed when the. NET webbrowser control loads a webpage.

Source: Internet
Author: User

 

The progress is displayed when the webbrowser control in C # loads a webpage.

 

Code

  Private   Void Webbrowser1_progresschanged ( Object Sender, webbrowserprogresschangedeventargs E)
{
Progressbar1.visible =   True ;

If (E. currentprogress > 0 ) && (E. maximumprogress > 0 ))
{

progressbar1.maximum = convert. toint32 (E. maximumprogress); /// set the total number of bytes of the document being loaded

progressbar1.step = convert. toint32 (E. currentprogress); // /get the number of bytes of the downloaded document

progressbar1.20.mstep ();

}

Else If(Webbrowser1.readystate=Webbrowserreadystate. Complete)//Hide the progress bar after loading
{

Progressbar1.value= 0;

Progressbar1.visible= False;

}

}

private void form1_load ( Object sender, eventargs e)
{< br> URI strurl = New uri ( " http://www.hainan.com " );

Webbrowser1.url=Strurl;

Webbrowser1.progresschanged+ = NewWebbrowserprogresschangedeventhandler (webbrowser1_progresschanged );

}

 

 

Display progress when the webbrowser control in VB. NET loads a webpage

 

Code

  Private   Sub Webbrowser1_progresschanged ( Byval Sender As System. object, Byval E As System. Windows. Forms. webbrowserprogresschangedeventargs) Handles Webbrowser1.progresschanged
Toolstripprogressbar1.visible =   True

If (E. currentprogress > 0 ) and (E. maximumprogress > 0 ) then

toolstripprogressbar1.maximum = convert. toint32 (E. maximumprogress) ' set the total number of bytes of the document being loaded

toolstripprogressbar1.step = convert. toint32 (E. currentprogress) ' // get the number of bytes of the downloaded document

toolstripprogressbar1.20.mstep ()

ElseifWebbrowser1.readystate=Webbrowserreadystate. CompleteThen

Toolstripprogressbar1.value= 0

Toolstripprogressbar1.visible= False

End If
End sub

 

 

  How does statusstrip Add a split column? ?

The "missing" function in vs2005 should be implemented,

You can change it manually.Code, Change one of its itme to this separator. For example:

 

Private system. Windows. Forms. toolstripstatuslabel toolseparator1;
Change:
Private system. Windows. Forms. toolstripseparator toolseparator1;

That is to say, this separator is still toolstripseparator.
This modification can be directly modified in the form1.designer. CS file of the Form. After the modification is completed, check that the modification is correct and switch to the setting interface to display the separator "|.


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.