ToolStripDesignerAvailabilityAttribute.cs source code in C# .NET

Source code for the .NET framework in C#

                        

Code:

/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / WinForms / Managed / System / WinForms / Design / ToolStripDesignerAvailabilityAttribute.cs / 1305376 / ToolStripDesignerAvailabilityAttribute.cs

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

namespace System.Windows.Forms.Design { 
using System.Diagnostics.CodeAnalysis; 

       [AttributeUsage(AttributeTargets.Class)] 
       public sealed class ToolStripItemDesignerAvailabilityAttribute : Attribute {
           private ToolStripItemDesignerAvailability  visibility;
            [
                SuppressMessage("Microsoft.Security", "CA2104:DoNotDeclareReadOnlyMutableReferenceTypes")   // ToolStripDesignAvailabilityAttribute is 
                                                                                                            // actually immutable.
            ] 
           public static readonly ToolStripItemDesignerAvailabilityAttribute Default = new ToolStripItemDesignerAvailabilityAttribute(); 

           //  
           // Specifies which ToolStrip types the Item can appear in - ToolStrip,MenuStrip,StatusStrip,ContextMenuStrip
           // Adding this attribute over a class lets you add to the list of custom items in the ToolStrip design time.
           // 
           public ToolStripItemDesignerAvailabilityAttribute() { 
                this.visibility = ToolStripItemDesignerAvailability.None;
           } 
 
           public ToolStripItemDesignerAvailabilityAttribute(ToolStripItemDesignerAvailability visibility) {
              this.visibility = visibility; 
           }

           public ToolStripItemDesignerAvailability ItemAdditionVisibility {
               get { 
                   return visibility;
               } 
           } 
           public override bool Equals(object obj) {
               if (obj == this) { 
                   return true;
               }

               ToolStripItemDesignerAvailabilityAttribute other = obj as ToolStripItemDesignerAvailabilityAttribute; 
               return (other != null) && other.ItemAdditionVisibility == this.visibility;
           } 
 
           public override int GetHashCode() {
               return visibility.GetHashCode(); 
           }

           public override bool IsDefaultAttribute() {
               return (this.Equals(Default)); 
           }
       } 
 

} 



// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
                        

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