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
- OracleCommandBuilder.cs
- ProviderCommandInfoUtils.cs
- WebPartPersonalization.cs
- GiveFeedbackEventArgs.cs
- FormsAuthenticationCredentials.cs
- CapabilitiesUse.cs
- TileModeValidation.cs
- PartitionResolver.cs
- WorkflowOperationFault.cs
- Identity.cs
- CodeSnippetExpression.cs
- DocumentsTrace.cs
- TextMetrics.cs
- PropertyIdentifier.cs
- DocumentPage.cs
- PagerStyle.cs
- OpenFileDialog.cs
- InputBinder.cs
- ControlPropertyNameConverter.cs
- GridViewUpdatedEventArgs.cs
- EventManager.cs
- SafeSecurityHandles.cs
- _HTTPDateParse.cs
- ItemsPanelTemplate.cs
- HttpModuleActionCollection.cs
- CryptoStream.cs
- MetadataCacheItem.cs
- SessionStateSection.cs
- COM2FontConverter.cs
- SessionIDManager.cs
- ScrollContentPresenter.cs
- DuplicateWaitObjectException.cs
- WhileDesigner.xaml.cs
- HtmlTableCell.cs
- KnownColorTable.cs
- SqlCacheDependencyDatabaseCollection.cs
- NamedPermissionSet.cs
- COSERVERINFO.cs
- UpdatePanel.cs
- CustomWebEventKey.cs
- TextBoxLine.cs
- OletxVolatileEnlistment.cs
- XmlC14NWriter.cs
- TcpAppDomainProtocolHandler.cs
- TemplateControlParser.cs
- DataTableCollection.cs
- TimeoutException.cs
- AvtEvent.cs
- XmlSiteMapProvider.cs
- BuildDependencySet.cs
- DataBoundLiteralControl.cs
- InfoCardRSAPKCS1KeyExchangeFormatter.cs
- xmlsaver.cs
- Transform.cs
- dbdatarecord.cs
- cache.cs
- SoapEnumAttribute.cs
- TimeoutException.cs
- SortedDictionary.cs
- DataGridViewIntLinkedList.cs
- SelectionPattern.cs
- SqlEnums.cs
- EventProvider.cs
- ContextMarshalException.cs
- ObjectDataSourceDisposingEventArgs.cs
- HttpRequestCacheValidator.cs
- DataListItemCollection.cs
- HitTestParameters.cs
- OleDbMetaDataFactory.cs
- filewebrequest.cs
- DifferencingCollection.cs
- SQLSingle.cs
- PropertyRef.cs
- MissingSatelliteAssemblyException.cs
- TraceListeners.cs
- InvokeWebService.cs
- WindowsUpDown.cs
- ToolbarAUtomationPeer.cs
- ISessionStateStore.cs
- InputBuffer.cs
- RegexFCD.cs
- HwndKeyboardInputProvider.cs
- IdentitySection.cs
- SQLResource.cs
- PerfCounters.cs
- TypographyProperties.cs
- TableRowsCollectionEditor.cs
- UrlAuthFailedErrorFormatter.cs
- SqlCharStream.cs
- ImportCatalogPart.cs
- WinFormsSecurity.cs
- ContentType.cs
- SuppressMessageAttribute.cs
- ObsoleteAttribute.cs
- SortKey.cs
- DesignerDataConnection.cs
- QueryResponse.cs
- ComponentEvent.cs
- SkewTransform.cs
- ListenerSingletonConnectionReader.cs