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
- Splitter.cs
- ManagementObjectCollection.cs
- TemplateField.cs
- ResourceExpressionBuilder.cs
- WpfKnownTypeInvoker.cs
- MappingMetadataHelper.cs
- CultureTableRecord.cs
- mda.cs
- IisTraceWebEventProvider.cs
- SimpleFieldTemplateUserControl.cs
- mda.cs
- ComponentDispatcherThread.cs
- ToolTipAutomationPeer.cs
- ToolStripDropDownDesigner.cs
- PlanCompilerUtil.cs
- DataSourceCollectionBase.cs
- DispatcherHookEventArgs.cs
- DataTemplateKey.cs
- ToolBarButtonClickEvent.cs
- EntityDataSourceDesignerHelper.cs
- Converter.cs
- GridViewRowEventArgs.cs
- DataKeyCollection.cs
- BuildManagerHost.cs
- StorageInfo.cs
- EventBookmark.cs
- TerminatorSinks.cs
- SecurityChannel.cs
- PropertyGroupDescription.cs
- ConditionalExpression.cs
- Track.cs
- BinaryWriter.cs
- GrammarBuilderDictation.cs
- MinimizableAttributeTypeConverter.cs
- GridView.cs
- ReadOnlyCollectionBuilder.cs
- SymbolMethod.cs
- GeneralTransform3DGroup.cs
- WorkflowTerminatedException.cs
- Material.cs
- EmulateRecognizeCompletedEventArgs.cs
- ProcessInfo.cs
- SoapObjectReader.cs
- KeyboardEventArgs.cs
- SignatureResourcePool.cs
- Binding.cs
- OdbcRowUpdatingEvent.cs
- CanonicalFormWriter.cs
- AnimationStorage.cs
- _CommandStream.cs
- WebConfigurationManager.cs
- XmlTextReaderImplHelpers.cs
- PageAsyncTask.cs
- FormatterConverter.cs
- ProbeDuplex11AsyncResult.cs
- C14NUtil.cs
- ArrayMergeHelper.cs
- StyleXamlTreeBuilder.cs
- CryptoKeySecurity.cs
- DiagnosticsConfigurationHandler.cs
- UInt16.cs
- ImageDrawing.cs
- Page.cs
- XmlSchemaObject.cs
- ClientScriptManager.cs
- CustomTypeDescriptor.cs
- Point3D.cs
- SettingsAttributeDictionary.cs
- DbConnectionPoolCounters.cs
- DropTarget.cs
- ByteFacetDescriptionElement.cs
- CustomWebEventKey.cs
- WhitespaceRuleLookup.cs
- WarningException.cs
- IOThreadScheduler.cs
- ApplicationGesture.cs
- ChannelSettingsElement.cs
- InvalidDataException.cs
- PageClientProxyGenerator.cs
- BrowserInteropHelper.cs
- DatePicker.cs
- SemanticValue.cs
- TypeConverterHelper.cs
- EllipseGeometry.cs
- ProtocolsConfigurationHandler.cs
- ObjectItemCollectionAssemblyCacheEntry.cs
- StringFreezingAttribute.cs
- XmlSchemaParticle.cs
- RunInstallerAttribute.cs
- SQLInt16Storage.cs
- HiddenFieldPageStatePersister.cs
- TcpDuplicateContext.cs
- MetadataSource.cs
- CellTreeNode.cs
- WindowsFormsHostPropertyMap.cs
- SemaphoreFullException.cs
- SecurityElement.cs
- WebPartConnectionsConfigureVerb.cs
- Bitmap.cs
- HandleCollector.cs