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
- Roles.cs
- BindToObject.cs
- XhtmlConformanceSection.cs
- __FastResourceComparer.cs
- TimeStampChecker.cs
- webbrowsersite.cs
- FlowSwitchDesigner.xaml.cs
- UpdatableWrapper.cs
- MouseGesture.cs
- BuildResult.cs
- VariableDesigner.xaml.cs
- SyndicationPerson.cs
- ThreadStartException.cs
- DataTableClearEvent.cs
- HttpCookie.cs
- EdmToObjectNamespaceMap.cs
- XmlSiteMapProvider.cs
- HttpListenerRequest.cs
- Geometry.cs
- EntityWithChangeTrackerStrategy.cs
- ExtensionWindowHeader.cs
- DbProviderFactories.cs
- IgnoreFileBuildProvider.cs
- SystemFonts.cs
- TextBox.cs
- WaveHeader.cs
- SimpleHandlerBuildProvider.cs
- WorkItem.cs
- Processor.cs
- UnknownBitmapDecoder.cs
- ProxyWebPartManagerDesigner.cs
- AvtEvent.cs
- WebPartUserCapability.cs
- AstNode.cs
- Size.cs
- ResourceExpression.cs
- TextModifier.cs
- SafeCryptContextHandle.cs
- Stylesheet.cs
- ThemeDictionaryExtension.cs
- IntegerValidator.cs
- RegexMatchCollection.cs
- DataControlCommands.cs
- StylusPlugin.cs
- CompositeDataBoundControl.cs
- InputScopeConverter.cs
- HostVisual.cs
- AppendHelper.cs
- ButtonFlatAdapter.cs
- CryptoHelper.cs
- ViewGenResults.cs
- FaultBookmark.cs
- WebPartEditorApplyVerb.cs
- TripleDES.cs
- RenderDataDrawingContext.cs
- DocumentApplicationJournalEntry.cs
- ValidationError.cs
- DispatchChannelSink.cs
- DataGridColumnCollection.cs
- ScrollChrome.cs
- CompiledQueryCacheEntry.cs
- EndOfStreamException.cs
- ExpressionBuilderCollection.cs
- followingquery.cs
- RotationValidation.cs
- Buffer.cs
- BamlBinaryWriter.cs
- OpenFileDialog.cs
- DataGridClipboardCellContent.cs
- DbProviderFactoriesConfigurationHandler.cs
- HtmlEncodedRawTextWriter.cs
- RegexMatchCollection.cs
- ChtmlFormAdapter.cs
- Bits.cs
- CachedPathData.cs
- MimeBasePart.cs
- ISO2022Encoding.cs
- odbcmetadatacolumnnames.cs
- Debugger.cs
- WorkflowNamespace.cs
- SQLUtility.cs
- TokenBasedSet.cs
- SspiSecurityTokenParameters.cs
- InkCanvasAutomationPeer.cs
- EntitySet.cs
- DiagnosticsConfiguration.cs
- TextStore.cs
- ButtonChrome.cs
- CheckBox.cs
- SqlGenericUtil.cs
- ScheduleChanges.cs
- SHA384.cs
- AssemblyBuilder.cs
- SqlProcedureAttribute.cs
- BitmapSourceSafeMILHandle.cs
- DynamicMethod.cs
- Emitter.cs
- DiagnosticsConfigurationHandler.cs
- EntityClientCacheKey.cs
- EventBuilder.cs