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
- BrushMappingModeValidation.cs
- Metadata.cs
- RadioButtonRenderer.cs
- NullableFloatSumAggregationOperator.cs
- LinqExpressionNormalizer.cs
- XsltOutput.cs
- GlyphInfoList.cs
- CalendarData.cs
- TypeExtensionConverter.cs
- Screen.cs
- BinaryMethodMessage.cs
- XamlFxTrace.cs
- DefaultValueMapping.cs
- OpacityConverter.cs
- ListBoxItem.cs
- WsdlInspector.cs
- WebPartConnectionsEventArgs.cs
- DocumentOutline.cs
- DecimalAnimationBase.cs
- NetworkAddressChange.cs
- ItemContainerProviderWrapper.cs
- ResourceDescriptionAttribute.cs
- Span.cs
- OverlappedContext.cs
- SafeCloseHandleCritical.cs
- ChildChangedEventArgs.cs
- ConfigPathUtility.cs
- FileInfo.cs
- TagMapInfo.cs
- FixedBufferAttribute.cs
- SchemaEntity.cs
- MultidimensionalArrayItemReference.cs
- WebServiceErrorEvent.cs
- SimpleType.cs
- RecognitionEventArgs.cs
- SerializationInfoEnumerator.cs
- OperationResponse.cs
- PeerApplication.cs
- TdsValueSetter.cs
- AnonymousIdentificationModule.cs
- CustomPeerResolverService.cs
- ImageUrlEditor.cs
- Attribute.cs
- InteropExecutor.cs
- DataSourceHelper.cs
- Util.cs
- UpdatePanelTriggerCollection.cs
- WebPartHelpVerb.cs
- URLEditor.cs
- TableItemPattern.cs
- BrowserCapabilitiesCodeGenerator.cs
- ToolStripDropTargetManager.cs
- IssuedTokenParametersElement.cs
- PointLightBase.cs
- NameTable.cs
- ProfilePropertyNameValidator.cs
- WindowsScrollBarBits.cs
- X509CertificateCollection.cs
- ToolboxItemWrapper.cs
- ThreadExceptionDialog.cs
- SBCSCodePageEncoding.cs
- DesignerCalendarAdapter.cs
- PEFileReader.cs
- HtmlPhoneCallAdapter.cs
- HuffmanTree.cs
- DocumentViewerAutomationPeer.cs
- Util.cs
- AssociationSetMetadata.cs
- AstTree.cs
- Query.cs
- BasicExpandProvider.cs
- OverflowException.cs
- EntityUtil.cs
- CodeValidator.cs
- ResourceManager.cs
- ObsoleteAttribute.cs
- ModifiableIteratorCollection.cs
- WinHttpWebProxyFinder.cs
- Native.cs
- StylusPlugin.cs
- SettingsSection.cs
- RequestResizeEvent.cs
- TableHeaderCell.cs
- DataGridTableCollection.cs
- Stroke2.cs
- SqlTriggerContext.cs
- DocumentViewer.cs
- ServiceOperationDetailViewControl.cs
- Event.cs
- EndOfStreamException.cs
- TokenFactoryCredential.cs
- MouseActionConverter.cs
- MediaElementAutomationPeer.cs
- SafeNativeMethodsMilCoreApi.cs
- SoapSchemaMember.cs
- IImplicitResourceProvider.cs
- KerberosReceiverSecurityToken.cs
- PackWebResponse.cs
- ClientSideProviderDescription.cs
- HttpConfigurationSystem.cs