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
- GetReadStreamResult.cs
- dataSvcMapFileLoader.cs
- BrowserDefinition.cs
- EventQueueState.cs
- PenThreadPool.cs
- LineVisual.cs
- SafeNativeMethods.cs
- ItemType.cs
- ImpersonationContext.cs
- IndentedWriter.cs
- DataStreams.cs
- MonitorWrapper.cs
- OperationCanceledException.cs
- BypassElementCollection.cs
- CodeConditionStatement.cs
- ProfileService.cs
- GuidConverter.cs
- StylesEditorDialog.cs
- LookupNode.cs
- ParameterExpression.cs
- CompressEmulationStream.cs
- TraceData.cs
- MessageBox.cs
- sitestring.cs
- initElementDictionary.cs
- PropertyChangeTracker.cs
- MonitoringDescriptionAttribute.cs
- SHA512Cng.cs
- MediaCommands.cs
- HandleRef.cs
- COSERVERINFO.cs
- cookiecollection.cs
- StringStorage.cs
- RemoteWebConfigurationHost.cs
- MailBnfHelper.cs
- DbProviderSpecificTypePropertyAttribute.cs
- PagesChangedEventArgs.cs
- WebUtil.cs
- WebBrowser.cs
- MdiWindowListStrip.cs
- Helper.cs
- SystemUnicastIPAddressInformation.cs
- TabControlDesigner.cs
- ObjectDataSourceSelectingEventArgs.cs
- BuildTopDownAttribute.cs
- DataRowChangeEvent.cs
- AlignmentXValidation.cs
- CheckedPointers.cs
- RedistVersionInfo.cs
- CodePropertyReferenceExpression.cs
- ConfigXmlElement.cs
- StatusBarAutomationPeer.cs
- tooltip.cs
- XmlILAnnotation.cs
- ProfileGroupSettings.cs
- XsltException.cs
- DataGridViewSortCompareEventArgs.cs
- RequiredAttributeAttribute.cs
- WizardStepBase.cs
- TableLayoutSettingsTypeConverter.cs
- ParamArrayAttribute.cs
- EventlogProvider.cs
- ToolStripDropTargetManager.cs
- PackagingUtilities.cs
- StructureChangedEventArgs.cs
- ScriptReference.cs
- ListenerElementsCollection.cs
- BehaviorEditorPart.cs
- _TimerThread.cs
- MessageQueueTransaction.cs
- GregorianCalendar.cs
- HttpValueCollection.cs
- InsufficientMemoryException.cs
- XmlIncludeAttribute.cs
- DispatcherSynchronizationContext.cs
- UIElementAutomationPeer.cs
- UInt32Converter.cs
- DiscreteKeyFrames.cs
- RemotingSurrogateSelector.cs
- RuntimeConfigurationRecord.cs
- Transform3D.cs
- DbConnectionPool.cs
- FileChangesMonitor.cs
- UnsignedPublishLicense.cs
- SlotInfo.cs
- EllipseGeometry.cs
- SplitterPanel.cs
- LinearQuaternionKeyFrame.cs
- PropertyChangedEventArgs.cs
- WindowsTitleBar.cs
- IconBitmapDecoder.cs
- XmlDomTextWriter.cs
- ClientScriptManagerWrapper.cs
- IPEndPoint.cs
- DefaultValueConverter.cs
- CompensationHandlingFilter.cs
- Screen.cs
- WorkflowPersistenceService.cs
- AnnotationMap.cs
- RoleBoolean.cs