Code:
/ DotNET / DotNET / 8.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
- EncoderNLS.cs
- DictionaryContent.cs
- ServerValidateEventArgs.cs
- TokenBasedSetEnumerator.cs
- EmptyEnumerable.cs
- BoundPropertyEntry.cs
- ToolStripPanelRenderEventArgs.cs
- VariableQuery.cs
- CollectionView.cs
- Transform3D.cs
- DocumentsTrace.cs
- SafeCertificateStore.cs
- DependencyPropertyConverter.cs
- ActivationArguments.cs
- PropertyPath.cs
- RectKeyFrameCollection.cs
- SQLDateTime.cs
- ImageCodecInfoPrivate.cs
- EventHandlersStore.cs
- SimplePropertyEntry.cs
- MailAddress.cs
- Mutex.cs
- DefaultAuthorizationContext.cs
- XmlNodeList.cs
- MaskDescriptor.cs
- EntityDesignerUtils.cs
- CallContext.cs
- OrderByQueryOptionExpression.cs
- SessionStateContainer.cs
- TableRow.cs
- ObjectHelper.cs
- AuthenticatedStream.cs
- ColorAnimationBase.cs
- PropertyToken.cs
- DbMetaDataFactory.cs
- Int32CollectionConverter.cs
- OdbcConnectionFactory.cs
- DescendentsWalker.cs
- ActiveXContainer.cs
- DropDownButton.cs
- HMAC.cs
- BinaryUtilClasses.cs
- BinarySecretKeyIdentifierClause.cs
- RoutedEventValueSerializer.cs
- SqlCachedBuffer.cs
- ItemsPresenter.cs
- CapacityStreamGeometryContext.cs
- ScheduleChanges.cs
- MouseOverProperty.cs
- ManualResetEvent.cs
- Size.cs
- TableCell.cs
- SqlWebEventProvider.cs
- TableProvider.cs
- ContactManager.cs
- HashCodeCombiner.cs
- TableDetailsCollection.cs
- ResourceDisplayNameAttribute.cs
- AuthenticationService.cs
- MetadataArtifactLoaderCompositeFile.cs
- IndexedGlyphRun.cs
- FlowchartDesignerCommands.cs
- HandlerBase.cs
- WorkflowRuntimeServiceElementCollection.cs
- AdapterDictionary.cs
- FontClient.cs
- DbConvert.cs
- ProfileGroupSettings.cs
- ToolStripPanel.cs
- KoreanLunisolarCalendar.cs
- ApplicationServicesHostFactory.cs
- AttributeData.cs
- ConfigXmlText.cs
- ClipboardData.cs
- IndependentAnimationStorage.cs
- ALinqExpressionVisitor.cs
- InstanceValue.cs
- SectionRecord.cs
- RootProfilePropertySettingsCollection.cs
- ImageMap.cs
- EdmToObjectNamespaceMap.cs
- TextBlock.cs
- MachineKey.cs
- KeySplineConverter.cs
- SinglePageViewer.cs
- ConfigurationValue.cs
- LazyTextWriterCreator.cs
- ReflectionTypeLoadException.cs
- BufferModeSettings.cs
- SqlClientWrapperSmiStream.cs
- FontCacheUtil.cs
- NamespaceQuery.cs
- StickyNote.cs
- DbConnectionPoolIdentity.cs
- DockProviderWrapper.cs
- QuaternionValueSerializer.cs
- CacheMemory.cs
- ToolStripItemCollection.cs
- IndexedEnumerable.cs
- SystemException.cs