This documentation is archived and is not being maintained.
PropertyTabScope Enumeration
Visual Studio 2010
Defines identifiers that indicate the persistence scope of a tab in the Properties window.
Assembly: System (in System.dll)
| Member name | Description | |
|---|---|---|
| Static | This tab is added to the Properties window and cannot be removed. | |
| Global | This tab is added to the Properties window and can only be removed explicitly by a parent component. | |
| Document | This tab is specific to the current document. This tab is added to the Properties window and is removed when the currently selected document changes. | |
| Component | This tab is specific to the current component. This tab is added to the Properties window for the current component only and is removed when the component is no longer selected. |
PropertyTabScope indicates the persistence scope of a tab that is displayed in the Properties window when a component of a design document has an associated PropertyTabAttribute.
The following code example demonstrates how to use PropertyTabScope to specify the scope of a property tab.
#using <System.Windows.Forms.dll> #using <System.Drawing.dll> #using <System.dll> using namespace System; using namespace System::ComponentModel; using namespace System::ComponentModel::Design; using namespace System::Drawing; using namespace System::IO; using namespace System::Reflection; using namespace System::Runtime::Serialization; using namespace System::Runtime::Serialization::Formatters::Binary; using namespace System::Windows::Forms; using namespace System::Windows::Forms::Design; using namespace System::Security::Permissions; namespace TypeCategoryTabExample { ref class TypeCategoryTab; // forward declaration. // This component adds a TypeCategoryTab to the propery browser // that is available for any components in the current design mode document. [PropertyTabAttribute(TypeCategoryTabExample::TypeCategoryTab::typeid,PropertyTabScope::Document)] public ref class TypeCategoryTabComponent: public System::ComponentModel::Component { public: TypeCategoryTabComponent(){} }; // A TypeCategoryTab property tab lists properties by the // category of the type of each property. public ref class TypeCategoryTab: public PropertyTab { private: // This String^ contains a Base-64 encoded and serialized example property tab image. [BrowsableAttribute(true)] String^ img; public: TypeCategoryTab() { img = "AAEAAAD/////AQAAAAAAAAAMAgAAAFRTeXN0ZW0uRHJhd2luZywgVmVyc2lvbj0xLjAuMzMwMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWIwM2Y1ZjdmMTFkNTBhM2EFAQAAABVTeXN0ZW0uRHJhd2luZy5CaXRtYXABAAAABERhdGEHAgIAAAAJAwAAAA8DAAAA9gAAAAJCTfYAAAAAAAAANgAAACgAAAAIAAAACAAAAAEAGAAAAAAAAAAAAMQOAADEDgAAAAAAAAAAAAD///////////////////////////////////9ZgABZgADzPz/zPz/zPz9AgP//////////gAD/gAD/AAD/AAD/AACKyub///////+AAACAAAAAAP8AAP8AAP9AgP////////9ZgABZgABz13hz13hz13hAgP//////////gAD/gACA/wCA/wCA/wAA//////////+AAACAAAAAAP8AAP8AAP9AgP////////////////////////////////////8L"; } // Returns the properties of the specified component extended with // a CategoryAttribute reflecting the name of the type of the property. [ReflectionPermission(SecurityAction::Demand, Flags=ReflectionPermissionFlag::MemberAccess)] virtual System::ComponentModel::PropertyDescriptorCollection^ GetProperties( Object^ component, array<System::Attribute^>^attributes ) override { PropertyDescriptorCollection^ props; if ( attributes == nullptr ) props = TypeDescriptor::GetProperties( component ); else props = TypeDescriptor::GetProperties( component, attributes ); array<PropertyDescriptor^>^propArray = gcnew array<PropertyDescriptor^>(props->Count); for ( int i = 0; i < props->Count; i++ ) { // Create a new PropertyDescriptor from the old one, with // a CategoryAttribute matching the name of the type. array<Attribute^>^temp0 = {gcnew CategoryAttribute( props[ i ]->PropertyType->Name )}; propArray[ i ] = TypeDescriptor::CreateProperty( props[ i ]->ComponentType, props[ i ], temp0 ); } return gcnew PropertyDescriptorCollection( propArray ); } virtual System::ComponentModel::PropertyDescriptorCollection^ GetProperties( Object^ component ) override { return this->GetProperties( component, nullptr ); } property String^ TabName { // Provides the name for the property tab. virtual String^ get() override { return "Properties by Type"; } } property System::Drawing::Bitmap^ Bitmap { // Provides an image for the property tab. virtual System::Drawing::Bitmap^ get() override { System::Drawing::Bitmap^ bmp = gcnew System::Drawing::Bitmap( DeserializeFromBase64Text( img ) ); return bmp; } } private: // This method can be used to retrieve an Image from a block of Base64-encoded text. Image^ DeserializeFromBase64Text( String^ text ) { Image^ img = nullptr; array<Byte>^memBytes = Convert::FromBase64String( text ); IFormatter^ formatter = gcnew BinaryFormatter; MemoryStream^ stream = gcnew MemoryStream( memBytes ); img = dynamic_cast<Image^>(formatter->Deserialize( stream )); stream->Close(); return img; } }; }
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Show: