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
- ProbeMatchesCD1.cs
- CompositeKey.cs
- Header.cs
- ResolveDuplexCD1AsyncResult.cs
- HttpModuleActionCollection.cs
- DocumentViewerHelper.cs
- FactoryGenerator.cs
- ResourceReader.cs
- CodeTypeConstructor.cs
- FileRecordSequenceCompletedAsyncResult.cs
- TreeBuilderBamlTranslator.cs
- DrawingCollection.cs
- PaintEvent.cs
- NativeMethods.cs
- UpDownBase.cs
- URLBuilder.cs
- ExecutedRoutedEventArgs.cs
- Decimal.cs
- LambdaCompiler.Generated.cs
- NavigatingCancelEventArgs.cs
- BitVector32.cs
- FileSecurity.cs
- DriveNotFoundException.cs
- TemplateManager.cs
- ListViewTableRow.cs
- XmlNodeComparer.cs
- SessionEndingCancelEventArgs.cs
- MobileComponentEditorPage.cs
- StyleBamlTreeBuilder.cs
- XmlSchemaSet.cs
- TreeViewAutomationPeer.cs
- ClientBuildManagerCallback.cs
- LicenseContext.cs
- ContentPlaceHolderDesigner.cs
- XmlSchemaSimpleContent.cs
- ExpressionConverter.cs
- ImportOptions.cs
- ExpanderAutomationPeer.cs
- SecurityKeyType.cs
- HttpRequest.cs
- ContentElement.cs
- followingsibling.cs
- RequestTimeoutManager.cs
- SqlTypesSchemaImporter.cs
- FlowPosition.cs
- XmlSigningNodeWriter.cs
- Quaternion.cs
- SafeThemeHandle.cs
- DataSourceXmlSerializationAttribute.cs
- DesignTimeResourceProviderFactoryAttribute.cs
- DefaultValidator.cs
- BamlTreeUpdater.cs
- ValueConversionAttribute.cs
- StructuredTypeEmitter.cs
- AspProxy.cs
- ErrorStyle.cs
- BindingNavigator.cs
- RowBinding.cs
- WebServiceData.cs
- SystemColorTracker.cs
- DbProviderManifest.cs
- WebMessageEncodingElement.cs
- ValidationRule.cs
- CapiHashAlgorithm.cs
- SegmentInfo.cs
- EntityStoreSchemaFilterEntry.cs
- KeyPressEvent.cs
- IisTraceListener.cs
- ListViewItemMouseHoverEvent.cs
- IxmlLineInfo.cs
- VirtualDirectoryMapping.cs
- TextPenaltyModule.cs
- SvcMapFileLoader.cs
- Simplifier.cs
- PrintControllerWithStatusDialog.cs
- NotConverter.cs
- StrokeIntersection.cs
- log.cs
- CryptoStream.cs
- ObjectParameter.cs
- DynamicResourceExtensionConverter.cs
- MenuItemBindingCollection.cs
- MetadataItem_Static.cs
- RegexRunnerFactory.cs
- SoapSchemaExporter.cs
- DataServiceConfiguration.cs
- TransactionScope.cs
- URLAttribute.cs
- FunctionParameter.cs
- TemplatePartAttribute.cs
- SetIterators.cs
- DataTable.cs
- NotificationContext.cs
- DataGridViewTextBoxCell.cs
- HTMLTextWriter.cs
- ShapeTypeface.cs
- CapabilitiesState.cs
- ToolStrip.cs
- DataBinder.cs
- ExtendedTransformFactory.cs