C # browser Tools

Source: Internet
Author: User

Webbrowser is used as a browser tool! Functions are similar to IE Toolbar.

The interface is as follows:

Main functions:

  • Web browsing
    Use webbrowser.
    The main problem is whether to load pages containing multiple frameworks. The method is as follows:
    Private VoidWebpanel_documentcompleted (ObjectSender, webbrowserdocumentcompletedeventargs E)
    {
    If(Webpanel. url. tostring ()! = E. url. tostring ())
    {
    Return;
    }
    //Webpage loaded
    }
  • Current network condition
    Run the ping command in C # To check the network status. Display 1 second Ping once www.baidu.com returns millisecond.
  • color retrieval on the webpage
    main screen color Retrieval Methods:
     color = color. white; 
    rectangle rect = screen. primaryscreen. bounds;
    using (bitmap BMP = New Bitmap ( 1 , 1 )
    {< br> using (Graphics G = graphics. fromimage (BMP)
    {< br> G. copyfromscreen (control. mouseposition. x, control. mouseposition. y, 0 , 0 , New size ( 1 , 1 );
    }< br> color = BMP. getpixel ( 0 , 0 );
    }< br>
    lblcolor. backcolor = color;
  • Add and execute JS
    Webpanel. Document. invokescript ("Eval",New Object[] {STR });
  • View the DOM tree(Attributes can be modified)
    Use propertygrid to display and modify the htmlelement attribute. You can use the delete key in the tree to delete the current node.
  • View attributes and styles of web page elements
    Call JS embedded in the pageCodeReturns the attribute and current style of the element. Use listview. You can use Ctrl + C to copy the selected value.
  • Count the number of web page elements
    Statistics using document. All, document. links, document. images, document. Forms, document. Window. Frames
  • Show all connections
    Display All connections on the current page in the table.
  • Show all images
    Displays all image objects on the current page in the table.
  • Show text only
    Use webpanel. Document. Write (webpanel. Document. Body. innertext );
  • Show all references(JS or style)
    Obtain the external JS and style sheet connections of all applications.
  • Personalized Status Bar(Current element position)
    Call js to display the border of the current element.
  • Adjust page size
  • Disable the pop-up page
  • Disable framework
    Call js to delete all framework pages on the current page.
    After the new page is loaded, some frameworks are dynamically added by PAGE Js. SoProgramAfter the page is loaded, the framework will be deleted after one second.
  • Flash prohibited
    Call js to delete all Flash files on the current page.
  • Only open on this page
    Set all connections to target = "_ Self"

 

Download: http://files.cnblogs.com/zjfree/WebTool.rar

Source code download: http://files.cnblogs.com/zjfree/WebTool_src.rar

Development Environment: win2003 + vs2005 +. net2.0 + C #

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.