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
- ReflectEventDescriptor.cs
- UserPersonalizationStateInfo.cs
- FieldReference.cs
- DragDrop.cs
- RestClientProxyHandler.cs
- DataListAutoFormat.cs
- DuplexChannel.cs
- UInt64.cs
- MouseEventArgs.cs
- ObjectConverter.cs
- webbrowsersite.cs
- UIPermission.cs
- CapiSymmetricAlgorithm.cs
- SerializeAbsoluteContext.cs
- TypedTableBaseExtensions.cs
- ChannelServices.cs
- VisualTransition.cs
- XMLSchema.cs
- ToolStripArrowRenderEventArgs.cs
- Journal.cs
- DataMisalignedException.cs
- DataGridViewSelectedColumnCollection.cs
- GeometryDrawing.cs
- FontWeight.cs
- ShapeTypeface.cs
- SoapExtensionReflector.cs
- GreenMethods.cs
- CodeTypeReferenceCollection.cs
- Overlapped.cs
- Buffer.cs
- AuthorizationRule.cs
- LineServices.cs
- SerializerDescriptor.cs
- ProtocolsConfiguration.cs
- PreviewPrintController.cs
- ProcessInfo.cs
- CharKeyFrameCollection.cs
- TransactionException.cs
- HtmlMeta.cs
- WindowShowOrOpenTracker.cs
- StorageComplexPropertyMapping.cs
- StringValidatorAttribute.cs
- ImageEditor.cs
- Size3DConverter.cs
- MetadataFile.cs
- HyperLinkDesigner.cs
- PlainXmlSerializer.cs
- EntityClientCacheKey.cs
- ActivityInstanceMap.cs
- XPathBinder.cs
- SharedStream.cs
- DataGridViewComboBoxColumn.cs
- WebPartUtil.cs
- DataFormats.cs
- XmlUtil.cs
- StylusCollection.cs
- XmlNavigatorFilter.cs
- XamlParser.cs
- SqlDataSourceCommandEventArgs.cs
- CLSCompliantAttribute.cs
- SqlMethodTransformer.cs
- HMACSHA512.cs
- XmlObjectSerializerReadContextComplexJson.cs
- CharacterString.cs
- LayoutInformation.cs
- FontUnitConverter.cs
- InvalidProgramException.cs
- RootBuilder.cs
- MatchingStyle.cs
- DBCommand.cs
- Types.cs
- SubclassTypeValidator.cs
- MethodBody.cs
- XmlBaseReader.cs
- MethodBuilder.cs
- SingleSelectRootGridEntry.cs
- CodeSpit.cs
- FixUpCollection.cs
- QilExpression.cs
- AuthStoreRoleProvider.cs
- DataAccessor.cs
- Item.cs
- GregorianCalendarHelper.cs
- SctClaimDictionary.cs
- BamlResourceDeserializer.cs
- PolicyConversionContext.cs
- SystemIPAddressInformation.cs
- CodeAttributeDeclaration.cs
- PreservationFileWriter.cs
- CheckBoxPopupAdapter.cs
- MethodCallTranslator.cs
- DataGridViewRowPrePaintEventArgs.cs
- SchemaCompiler.cs
- QueryBranchOp.cs
- SymmetricCryptoHandle.cs
- sqlpipe.cs
- ProtectedConfiguration.cs
- RightsController.cs
- HtmlControlPersistable.cs
- ByteConverter.cs