Click here to Skip to main content
15,894,291 members
Articles / Programming Languages / C#

WebBrowserControl for the .NET Framework 1.1

Rate me:
Please Sign up or sign in to vote.
3.06/5 (11 votes)
15 Apr 2010CPOL2 min read 98.8K   1.6K   21  
An implementation of a web browser control for the .NET Framework 1.1.
namespace Pajocomo.Windows.Forms
{
	/// <summary>
	/// Represents the method that will handle the <see cref="WebBrowserControl.ShowContextMenu"/> event of the <see cref="WebBrowserControl"/>.
	/// </summary>
	/// <param name="sender">
	/// The source of the event.
	/// </param>
	/// <param name="e">
	/// A <see cref="ShowContextMenuEventArgs"/> that contains the event data. 
	/// </param>
	public delegate void ShowContextMenuEventHandler(object sender, ShowContextMenuEventArgs e);

	/// <summary>
	/// Provides data for the <see cref="WebBrowserControl.ShowContextMenu"/> event.
	/// </summary>
	public class ShowContextMenuEventArgs : System.EventArgs
	{

		#region Private Instance Fields

		private ContextMenuType contextMenuType;
		private System.Drawing.Point location;
		private object commandTarget;
		private object element;
		private bool handled;

		#endregion

		#region Private Instance Constructors

		private ShowContextMenuEventArgs() {}

		#endregion

		#region Internal Instance Constructors

		/// <summary>
		/// Provides data for the <see cref="WebBrowserControl.ShowContextMenu"/> event.
		/// </summary>
		/// <param name="contextMenuType">The identifier of the shortcut menu to be displayed.</param>
		/// <param name="location">The screen coordinates for the menu.</param>
		/// <param name="commandTarget">The command target.</param>
		/// <param name="element">The object at the specified screen coordinates.</param>
		internal ShowContextMenuEventArgs(ContextMenuType contextMenuType, System.Drawing.Point location, object commandTarget, object element) : base()
		{
			this.contextMenuType = contextMenuType;
			this.location = location;
			this.commandTarget = commandTarget;
			this.element = element;
		}

		#endregion

		#region Public Instance Properties

		/// <summary>
		/// Gets a value indicating whether the <see cref="WebBrowserControl.ShowContextMenu"/> event was handled.
		/// </summary>
		/// <value><see langword="true"/> if handled; otherwise, <see langword="false"/>.</value>
		public bool Handled
		{
			get
			{
				return this.handled;
			}
			set
			{
				this.handled = value;
			}
		}

		/// <summary>
		/// Gets the identifier of the shortcut menu to be displayed.
		/// </summary>
		/// <value>The identifier of the shortcut menu to be displayed.</value>
		public ContextMenuType ContextMenuType
		{
			get
			{
				return this.contextMenuType;
			}
		}

		/// <summary>
		/// Gets the screen coordinates for the menu.
		/// </summary>
		/// <value>The screen coordinates for the menu.</value>
		public System.Drawing.Point Location
		{
			get
			{
				return this.location;
			}
		}

		/// <summary>
		/// Gets the command target.
		/// </summary>
		/// <value>The command target.</value>
		public object CommandTarget
		{
			get
			{
				return this.commandTarget;
			}
		}

		/// <summary>
		/// Gets the object at the screen coordinates specified in <see cref="Location"/>.
		/// </summary>
		/// <value>The object at the screen coordinates specified in <see cref="Location"/>.</value>
		/// <remarks>This allows a host to differentiate particular objects to provide more specific context.</remarks>
		public object Element
		{
			get
			{
				return this.element;
			}
		}

		#endregion

	}
}

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, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior) Paulo Morgado
Portugal Portugal

Comments and Discussions