Click here to Skip to main content
12,078,489 members (48,108 online)
Click here to Skip to main content

Stats

1.7M views
31.3K downloads
329 bookmarked
Posted

Extended .NET 2.0 WebBrowser Control

, 29 Mar 2006
Extending the .NET 2.0 WebBrowser control.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using ExtendedWebBrowser2.Properties;

namespace ExtendedWebBrowser2
{
  partial class OptionsForm : Form
  {
    public OptionsForm()
    {
      InitializeComponent();
    }

    private void OptionsForm_Load(object sender, EventArgs e)
    {
      SettingsHelper helper = SettingsHelper.Current;
      switch (helper.FilterLevel)
      {
        case PopupBlockerFilterLevel.High:
          this.filterLevelHighRadioButton.Checked = true;
          break;
        case PopupBlockerFilterLevel.Medium:
          this.filterLevelMediumRadioButton.Checked = true;
          break;
        case PopupBlockerFilterLevel.Low:
          this.filterLevelLowRadioButton.Checked = true;
          break;
        default:
          this.filterLevelNoneRadioButton.Checked = true;
          break;
      }
      this.doNotShowScriptErrorsCheckBox.Checked = !helper.ShowScriptErrors;

      // Check if we're working on Windows XP SP2 or higher.
      // Since the .Net Framework 2.0 requires SP2 to be installed,
      // and for Windows 2003 requires SP1 we do not need to check against 
      // the service pack level. We DO need to check the version number.
      if (!(Environment.OSVersion.Version.Major >= 5 && Environment.OSVersion.Version.Minor >= 1))
      {
        // The requirements for the pop-up blocker aren't met. 
        // Disable the groupbox with the settings.
        this.popupBlockerGroupBox.Enabled = false;
      }
    }

    private void okButton_Click(object sender, EventArgs e)
    {
      SettingsHelper helper = SettingsHelper.Current;
      if (this.filterLevelHighRadioButton.Checked)
        helper.FilterLevel = PopupBlockerFilterLevel.High;
      else if (this.filterLevelMediumRadioButton.Checked)
        helper.FilterLevel = PopupBlockerFilterLevel.Medium;
      else if (this.filterLevelLowRadioButton.Checked)
        helper.FilterLevel = PopupBlockerFilterLevel.Low;
      else
        helper.FilterLevel = PopupBlockerFilterLevel.None;
      helper.ShowScriptErrors = !this.doNotShowScriptErrorsCheckBox.Checked;
      helper.Save();
      DialogResult = DialogResult.OK;
      this.Close();
    }

  }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

Share

About the Author

Jeroen Landheer
Web Developer
Chile Chile
I am
- born in The Netherlands
- living in Chile together with my wife.
- a Microsoft Certified Professional Developer on all 3 areas (Windows, Web and Enterprise)
- an MCITP on Microsoft SQL Server 2005 (Database Administrator)
- an active programmer for about 14 years.
- a business owner, of a Dutch company called "The Wheel Automatisering" (http://www.thewheel.nl)
- a coder in C#, VB.Net and Managed C++.
- someone who likes to share knowledge

For fun I like to go out with my dogs, enjoy the sun or write some articles that I share with the community.

You may also be interested in...

| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.160212.1 | Last Updated 29 Mar 2006
Article Copyright 2006 by Jeroen Landheer
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid