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
- UnsafeNativeMethods.cs
- RemotingClientProxy.cs
- ComponentRenameEvent.cs
- BaseHashHelper.cs
- StatusBar.cs
- XmlTypeAttribute.cs
- PathGeometry.cs
- DiagnosticsConfigurationHandler.cs
- SmtpTransport.cs
- RenamedEventArgs.cs
- MimeTypeAttribute.cs
- TraceUtility.cs
- SerializationSectionGroup.cs
- Unit.cs
- PaintEvent.cs
- DateTimeConstantAttribute.cs
- CodeConstructor.cs
- TemplatedAdorner.cs
- IUnknownConstantAttribute.cs
- HtmlInputFile.cs
- IdentityManager.cs
- DocumentPageHost.cs
- DiagnosticsConfiguration.cs
- ListViewDeleteEventArgs.cs
- TreeNodeStyleCollection.cs
- WorkflowServiceNamespace.cs
- PartDesigner.cs
- PersianCalendar.cs
- ObservableCollectionDefaultValueFactory.cs
- DateTimeFormat.cs
- RuleSet.cs
- MultiAsyncResult.cs
- SystemIPv6InterfaceProperties.cs
- SafeRegistryHandle.cs
- Odbc32.cs
- TextOutput.cs
- NumericUpDown.cs
- KeyboardDevice.cs
- ConnectionStringEditor.cs
- ToolStripEditorManager.cs
- FontUnit.cs
- ParameterCollection.cs
- Overlapped.cs
- ScriptingRoleServiceSection.cs
- OnOperation.cs
- RightsManagementEncryptionTransform.cs
- AttachInfo.cs
- ForeignKeyConstraint.cs
- BasicExpressionVisitor.cs
- TagMapCollection.cs
- ProfessionalColors.cs
- WmlPageAdapter.cs
- SessionState.cs
- DefaultMemberAttribute.cs
- cache.cs
- Content.cs
- PolyLineSegment.cs
- RadioButton.cs
- ConstrainedDataObject.cs
- SpeakInfo.cs
- FlowThrottle.cs
- BindingMAnagerBase.cs
- Trace.cs
- DbReferenceCollection.cs
- PriorityBinding.cs
- EFColumnProvider.cs
- EventLogConfiguration.cs
- SrgsSubset.cs
- NotConverter.cs
- WindowsTreeView.cs
- MyContact.cs
- NCryptNative.cs
- CodeDelegateCreateExpression.cs
- UriExt.cs
- ProfileGroupSettings.cs
- FilterEventArgs.cs
- HttpRawResponse.cs
- WebBrowserBase.cs
- EdmComplexTypeAttribute.cs
- ZipIOFileItemStream.cs
- ProfilePropertySettingsCollection.cs
- SecurityIdentifierElement.cs
- CultureInfo.cs
- HuffModule.cs
- ZoneMembershipCondition.cs
- ApplicationSecurityManager.cs
- InternalBufferManager.cs
- PrinterSettings.cs
- DbXmlEnabledProviderManifest.cs
- BitmapImage.cs
- UnsafeNativeMethodsMilCoreApi.cs
- CapabilitiesSection.cs
- EntityConnection.cs
- PathFigureCollection.cs
- GraphicsContainer.cs
- CatalogPart.cs
- SqlParameter.cs
- DbConnectionPoolOptions.cs
- ChangePassword.cs
- BaseParaClient.cs