Code:
/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / ndp / fx / src / Designer / WinForms / System / WinForms / Design / ToolStripCustomTypeDescriptor.cs / 1 / ToolStripCustomTypeDescriptor.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.Collections; using System.ComponentModel.Design; using System.ComponentModel.Design.Serialization; using System.Windows.Forms; ////// ToolStripCustomTypeDescriptor class. /// internal class ToolStripCustomTypeDescriptor : CustomTypeDescriptor { ToolStrip instance = null; PropertyDescriptor propItems = null; PropertyDescriptorCollection collection = null; public ToolStripCustomTypeDescriptor(ToolStrip instance) : base() { this.instance = instance; } ////// /// The GetPropertyOwner method returns an instance of an object that /// owns the given property for the object this type descriptor is representing. /// An optional attribute array may be provided to filter the collection that is /// returned. Returning null from this method causes the TypeDescriptor object /// to use its default type description services. /// public override object GetPropertyOwner(PropertyDescriptor pd) { return instance; } ////// /// The GetProperties method returns a collection of property descriptors /// for the object this type descriptor is representing. An optional /// attribute array may be provided to filter the collection that is returned. /// If no parent is provided,this will return an empty /// property collection. /// public override PropertyDescriptorCollection GetProperties() { if (instance!= null && collection == null) { PropertyDescriptorCollection retColl = TypeDescriptor.GetProperties(instance); PropertyDescriptor[] propArray = new PropertyDescriptor[retColl.Count]; retColl.CopyTo(propArray, 0); collection = new PropertyDescriptorCollection(propArray, false); } if (collection.Count > 0) { propItems = collection["Items"]; if (propItems != null) { collection.Remove(propItems); } } return collection; } ////// /// The GetProperties method returns a collection of property descriptors /// for the object this type descriptor is representing. An optional /// attribute array may be provided to filter the collection that is returned. /// If no parent is provided,this will return an empty /// property collection. /// Here we will pass the "collection without the "items" property. /// public override PropertyDescriptorCollection GetProperties(Attribute[] attributes) { if (instance!= null && collection == null) { PropertyDescriptorCollection retColl = TypeDescriptor.GetProperties(instance); PropertyDescriptor[] propArray = new PropertyDescriptor[retColl.Count]; retColl.CopyTo(propArray, 0); collection = new PropertyDescriptorCollection(propArray, false); } if (collection.Count > 0) { propItems = collection["Items"]; if (propItems != null) { collection.Remove(propItems); } } return collection; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- PanelDesigner.cs
- InternalsVisibleToAttribute.cs
- NavigationProperty.cs
- UserNamePasswordClientCredential.cs
- UnsafeNativeMethods.cs
- PackageDigitalSignatureManager.cs
- BasePropertyDescriptor.cs
- ScrollData.cs
- DataReaderContainer.cs
- ItemPager.cs
- ServiceModelDictionary.cs
- WindowsAuthenticationEventArgs.cs
- DateTimeOffsetConverter.cs
- FileDialog.cs
- PrePrepareMethodAttribute.cs
- GlobalAllocSafeHandle.cs
- ConfigXmlAttribute.cs
- TreeNodeCollection.cs
- FlowDocumentReaderAutomationPeer.cs
- CodeDOMUtility.cs
- ShimAsPublicXamlType.cs
- Int32CAMarshaler.cs
- NativeRecognizer.cs
- ObjectSecurity.cs
- LoadGrammarCompletedEventArgs.cs
- SQLUtility.cs
- CodeAttributeArgument.cs
- SpotLight.cs
- NavigatorOutput.cs
- EventData.cs
- DeadCharTextComposition.cs
- BamlLocalizerErrorNotifyEventArgs.cs
- ProgressBarRenderer.cs
- StateMachine.cs
- SQLCharsStorage.cs
- SizeAnimation.cs
- contentDescriptor.cs
- ProviderIncompatibleException.cs
- XamlClipboardData.cs
- ControlEvent.cs
- SynchronizationLockException.cs
- HeaderLabel.cs
- TogglePatternIdentifiers.cs
- MultiTrigger.cs
- ObjectQuery.cs
- StringArrayConverter.cs
- TextServicesManager.cs
- DeploymentExceptionMapper.cs
- Behavior.cs
- ThrowOnMultipleAssignment.cs
- SchemaDeclBase.cs
- XmlObjectSerializerReadContext.cs
- XmlAttributes.cs
- milrender.cs
- AtlasWeb.Designer.cs
- ProcessHostServerConfig.cs
- SslStream.cs
- PermissionToken.cs
- StylusTip.cs
- HttpCachePolicy.cs
- ConvertTextFrag.cs
- rsa.cs
- InfoCardRSAPKCS1SignatureDeformatter.cs
- DesignTimeTemplateParser.cs
- DriveInfo.cs
- SqlServer2KCompatibilityCheck.cs
- DataGridBeginningEditEventArgs.cs
- ByeOperationAsyncResult.cs
- CodeComment.cs
- SoapTypeAttribute.cs
- CacheAxisQuery.cs
- TabItemAutomationPeer.cs
- TextAdaptor.cs
- WebPartCloseVerb.cs
- InternalsVisibleToAttribute.cs
- FrugalList.cs
- SimpleWebHandlerParser.cs
- XmlUrlEditor.cs
- LoaderAllocator.cs
- PackageRelationshipCollection.cs
- DataGridViewElement.cs
- DBSqlParserColumnCollection.cs
- ExceptionHelpers.cs
- SoapReflectionImporter.cs
- HttpCookieCollection.cs
- DataPagerFieldItem.cs
- TraceData.cs
- WebSysDescriptionAttribute.cs
- DesignerRegionMouseEventArgs.cs
- RelationshipWrapper.cs
- TextAction.cs
- Adorner.cs
- Vector3DAnimationUsingKeyFrames.cs
- XmlCharCheckingReader.cs
- SafeEventLogWriteHandle.cs
- TemplateBamlTreeBuilder.cs
- AddInActivator.cs
- TimeSpan.cs
- MobileUserControl.cs
- SqlProcedureAttribute.cs