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
- SecurityContextTokenValidationException.cs
- TimeoutException.cs
- _NTAuthentication.cs
- DataGridBeginningEditEventArgs.cs
- TrackingServices.cs
- Point4D.cs
- DBCommandBuilder.cs
- GcSettings.cs
- GenericAuthenticationEventArgs.cs
- InternalRelationshipCollection.cs
- QuaternionConverter.cs
- EventSinkHelperWriter.cs
- GeneralTransform3DTo2DTo3D.cs
- CompilationLock.cs
- UnmanagedMarshal.cs
- RuleDefinitions.cs
- XmlCustomFormatter.cs
- AsyncCompletedEventArgs.cs
- QilStrConcat.cs
- CaseInsensitiveComparer.cs
- XmlSchemaAny.cs
- HwndKeyboardInputProvider.cs
- UpdateException.cs
- SmiSettersStream.cs
- GridViewDeleteEventArgs.cs
- HostProtectionException.cs
- TextCompositionEventArgs.cs
- DebugViewWriter.cs
- EventSourceCreationData.cs
- SqlDataSourceCache.cs
- TraceContext.cs
- CodeSubDirectoriesCollection.cs
- QilXmlWriter.cs
- ComplusEndpointConfigContainer.cs
- MobileRedirect.cs
- Model3DGroup.cs
- MsmqIntegrationProcessProtocolHandler.cs
- HttpCapabilitiesEvaluator.cs
- StatementContext.cs
- FileLoadException.cs
- BufferedWebEventProvider.cs
- CustomSignedXml.cs
- SqlClientWrapperSmiStream.cs
- VerticalAlignConverter.cs
- ByeOperationCD1AsyncResult.cs
- PageTheme.cs
- TypeUnloadedException.cs
- MenuItemStyle.cs
- CompilerHelpers.cs
- OperationContext.cs
- UIElementHelper.cs
- DnsEndpointIdentity.cs
- XamlRtfConverter.cs
- Header.cs
- OlePropertyStructs.cs
- InvokePatternIdentifiers.cs
- XslVisitor.cs
- complextypematerializer.cs
- SpAudioStreamWrapper.cs
- Literal.cs
- CachedCompositeFamily.cs
- HttpModuleAction.cs
- ClassValidator.cs
- PrtTicket_Editor.cs
- CacheSection.cs
- StateElementCollection.cs
- TabletCollection.cs
- HtmlFormParameterWriter.cs
- ListControl.cs
- MappingException.cs
- Events.cs
- SettingsPropertyIsReadOnlyException.cs
- XmlDataProvider.cs
- SystemNetworkInterface.cs
- StateManagedCollection.cs
- ExpressionEditorAttribute.cs
- Aes.cs
- JsonSerializer.cs
- EditCommandColumn.cs
- Privilege.cs
- WorkflowInstanceUnhandledExceptionRecord.cs
- ImageSource.cs
- BinarySecretKeyIdentifierClause.cs
- Rijndael.cs
- DefaultValueConverter.cs
- XPathSelfQuery.cs
- DelegatingTypeDescriptionProvider.cs
- SafeProcessHandle.cs
- ThreadStateException.cs
- DocumentXmlWriter.cs
- ScrollChrome.cs
- SimpleWebHandlerParser.cs
- SystemMulticastIPAddressInformation.cs
- RelationshipEndMember.cs
- XamlBuildTaskServices.cs
- COM2FontConverter.cs
- XMLSyntaxException.cs
- MouseCaptureWithinProperty.cs
- DocumentViewerAutomationPeer.cs
- EnvelopedSignatureTransform.cs