C # simple browser for learning

Source: Internet
Author: User

Using System; using System. collections. generic; using System. componentModel; using System. data; using System. drawing; using System. linq; using System. text; using System. threading. tasks; using System. windows. forms; namespace demo8 {public partial class Form1: Form {public Form1 () {InitializeComponent ();} private void create NToolStripMenuItem_Click (object sender, EventArgs e) {Form2 fm2 = new Form2 (); fm2.MdiParent = this; // remember to set the IsMdiContainer of the form where this is located to true //. mdiParent = this the current form is the parent form of Form a;. mdiParent = this. mdiParent form a and the parent form of the current form are the same form fm2.Show ();} private void vertically tiled VToolStripMenuItem_Click (object sender, EventArgs e) {LayoutMdi (MdiLayout. tileVertical); // vertical tile} private void stacked ToolStripMenuItem_Click (object sender, EventArgs e) {LayoutMdi (MdiLayout. cascade); // Cascade} private void hToolStripMenuItem_Click (object sender, EventArgs e) {LayoutMdi (MdiLayout. tileHorizontal); // horizontal tile} private void lToolStripMenuItem_Click (object sender, EventArgs e) {foreach (Form childForm in mdichilform) {childForm. close () ;}// Close the subform }}}

Using System; using System. collections. generic; using System. componentModel; using System. data; using System. drawing; using System. linq; using System. text; using System. threading. tasks; using System. windows. forms; namespace demo8 {public partial class Form2: Form {public Form2 () {InitializeComponent ();} private void button#click (object sender, EventArgs e) // open the webpage {try {string str = textBox1.Text. trim (); webBrowser1.Navigate (new Uri ("http: //" + str); this. text = str;} catch (Exception ex) {MessageBox. show (ex. message. toString () ;}} private void button2_Click (object sender, EventArgs e) // refresh {webBrowser1.Refresh ();} private void button3_Click (object sender, EventArgs e) // Previous Page {webBrowser1.GoBack ();} private void button4_Click (object sender, EventArgs e) // next page {webBrowser1.GoForward ();}}}


Related Article

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.