DesignerVerbToolStripMenuItem.cs source code in C# .NET

Source code for the .NET framework in C#

                        

Code:

/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / ndp / fx / src / Designer / WinForms / System / WinForms / Design / DesignerVerbToolStripMenuItem.cs / 1 / DesignerVerbToolStripMenuItem.cs

                            //------------------------------------------------------------------------------ 
// 
//     Copyright (c) Microsoft Corporation.  All rights reserved.
// 
//----------------------------------------------------------------------------- 

/* 
 */ 
namespace System.Windows.Forms.Design
{ 
 	using System.Design;
	using System.ComponentModel;
	using System.Diagnostics;
	using System; 
 	using System.Security;
	using System.Security.Permissions; 
 	using System.ComponentModel.Design; 
 	using System.Windows.Forms;
	using System.Drawing; 
 	using System.Drawing.Design;
	using System.Windows.Forms.Design.Behavior;
	using System.Runtime.InteropServices;
	using System.Drawing.Drawing2D; 

 
 	///  
	/// 
 	///      Associates DesignerVerb with ToolStripMenuItem. 
 	/// 
	/// 
 	internal class DesignerVerbToolStripMenuItem : ToolStripMenuItem
	{ 
		DesignerVerb verb;
 
        // Text is a virtual method on the base class, but since we don't override it we should be okay. 
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
		public DesignerVerbToolStripMenuItem(DesignerVerb verb) 
 		{


			this.verb = verb; 
 			this.Text = verb.Text;
 
 			RefreshItem(); 

		} 

 		public void RefreshItem()
		{
			if (verb != null) 
			{
 				this.Visible = verb.Visible; 
				this.Enabled = verb.Enabled; 
 				this.Checked = verb.Checked;
 			} 
		}

 		protected override void OnClick(System.EventArgs e)
		{ 
			if (verb != null)
			{ 
 				verb.Invoke(); 
			}
 		} 
 	}
}


// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
                        

Link Menu

Network programming in C#, Network Programming in VB.NET, Network Programming in .NET
This book is available now!
Buy at Amazon US or
Buy at Amazon UK