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
- IList.cs
- ZipIOExtraField.cs
- TypeForwardedFromAttribute.cs
- CommandID.cs
- ProfileManager.cs
- ObjectCloneHelper.cs
- DataGridViewColumnDividerDoubleClickEventArgs.cs
- CompilerParameters.cs
- AssociationProvider.cs
- Baml2006SchemaContext.cs
- GridErrorDlg.cs
- SqlStatistics.cs
- IconBitmapDecoder.cs
- GraphicsState.cs
- TextTreeFixupNode.cs
- Int16AnimationUsingKeyFrames.cs
- PeerNameRegistration.cs
- SourceFileBuildProvider.cs
- FloaterParagraph.cs
- ObjectDataSourceFilteringEventArgs.cs
- ParsedRoute.cs
- RightsManagementInformation.cs
- InstanceNormalEvent.cs
- LinkArea.cs
- MailWriter.cs
- recordstatefactory.cs
- Merger.cs
- Column.cs
- PrePostDescendentsWalker.cs
- DownloadProgressEventArgs.cs
- XsltLoader.cs
- ExtensionWindow.cs
- DataGridViewCheckBoxColumn.cs
- CacheModeValueSerializer.cs
- InfiniteIntConverter.cs
- HtmlInputText.cs
- SQLInt64.cs
- ImageIndexEditor.cs
- VirtualPathProvider.cs
- SubstitutionList.cs
- SizeChangedInfo.cs
- OrderPreservingPipeliningMergeHelper.cs
- TextBreakpoint.cs
- SweepDirectionValidation.cs
- CookielessHelper.cs
- Rule.cs
- ToolStripItemCollection.cs
- XmlNodeList.cs
- GuidelineCollection.cs
- Compiler.cs
- OleDbConnectionInternal.cs
- EventTrigger.cs
- ReflectionUtil.cs
- WebPartVerbCollection.cs
- SqlUtil.cs
- UInt64Storage.cs
- ObjectManager.cs
- CollectionBase.cs
- HandlerWithFactory.cs
- Certificate.cs
- BlurBitmapEffect.cs
- FormsAuthenticationTicket.cs
- WindowsFont.cs
- PixelShader.cs
- SQLGuid.cs
- ConversionContext.cs
- RolePrincipal.cs
- panel.cs
- XmlChoiceIdentifierAttribute.cs
- WebEncodingValidatorAttribute.cs
- GridLengthConverter.cs
- XsdValidatingReader.cs
- NullPackagingPolicy.cs
- DesignerCategoryAttribute.cs
- LambdaExpression.cs
- PageSettings.cs
- CodeDirectoryCompiler.cs
- Model3DCollection.cs
- PageCodeDomTreeGenerator.cs
- ExpressionBinding.cs
- TextRangeEditLists.cs
- DbConnectionInternal.cs
- SettingsPropertyWrongTypeException.cs
- TableRow.cs
- BaseConfigurationRecord.cs
- WindowsListViewGroup.cs
- OutputCacheSettings.cs
- VectorConverter.cs
- OdbcPermission.cs
- PermissionRequestEvidence.cs
- XmlHierarchicalEnumerable.cs
- MediaTimeline.cs
- StartUpEventArgs.cs
- followingquery.cs
- ComponentEvent.cs
- DataTemplateSelector.cs
- WrapPanel.cs
- SecurityToken.cs
- DataGridViewCellConverter.cs
- TileBrush.cs