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
- columnmapkeybuilder.cs
- DynamicValidatorEventArgs.cs
- ButtonStandardAdapter.cs
- GenericEnumConverter.cs
- CommandHelper.cs
- CalendarDateChangedEventArgs.cs
- SettingsPropertyCollection.cs
- CollectionTraceRecord.cs
- ContentPlaceHolder.cs
- PageAdapter.cs
- PathFigure.cs
- LocationReferenceEnvironment.cs
- TraceHandlerErrorFormatter.cs
- DataTrigger.cs
- PolyLineSegment.cs
- MetadataUtilsSmi.cs
- LogStore.cs
- Delegate.cs
- ProviderCommandInfoUtils.cs
- OnOperation.cs
- Delegate.cs
- SerializationHelper.cs
- PersonalizationAdministration.cs
- Calendar.cs
- DefaultAuthorizationContext.cs
- ToolStripSeparator.cs
- RuntimeUtils.cs
- SubqueryRules.cs
- PerformanceCountersElement.cs
- HttpRequest.cs
- ToolStripDropTargetManager.cs
- ProtocolsSection.cs
- ReferenceService.cs
- QueryAsyncResult.cs
- Serializer.cs
- Attribute.cs
- MergeLocalizationDirectives.cs
- ReferencedType.cs
- CodeExpressionCollection.cs
- PrimitiveType.cs
- HttpContextServiceHost.cs
- Image.cs
- DiffuseMaterial.cs
- MetadataItemCollectionFactory.cs
- CompilerGeneratedAttribute.cs
- DataRecordInfo.cs
- Label.cs
- SmiEventSink_DeferedProcessing.cs
- EntitySqlQueryCacheEntry.cs
- InstancePersistenceException.cs
- EmptyStringExpandableObjectConverter.cs
- XmlWrappingReader.cs
- StyleBamlTreeBuilder.cs
- DomainUpDown.cs
- SourceElementsCollection.cs
- WaitHandle.cs
- DefaultSerializationProviderAttribute.cs
- DllNotFoundException.cs
- InstallerTypeAttribute.cs
- InputEventArgs.cs
- DefaultPrintController.cs
- Vector3D.cs
- Message.cs
- AccessibilityApplicationManager.cs
- ClickablePoint.cs
- TypeDependencyAttribute.cs
- TreeView.cs
- RotateTransform.cs
- TextTreeUndoUnit.cs
- BamlResourceContent.cs
- EventLog.cs
- FamilyCollection.cs
- LateBoundBitmapDecoder.cs
- activationcontext.cs
- SettingsPropertyNotFoundException.cs
- EventLogEntryCollection.cs
- PointAnimationClockResource.cs
- HttpHeaderCollection.cs
- WebBrowserPermission.cs
- XmlIgnoreAttribute.cs
- TreeViewCancelEvent.cs
- ShaperBuffers.cs
- ConvertBinder.cs
- SplineKeyFrames.cs
- DrawToolTipEventArgs.cs
- _NetRes.cs
- DesigntimeLicenseContext.cs
- LoginCancelEventArgs.cs
- SelectionListDesigner.cs
- CompositionCommandSet.cs
- NamespaceEmitter.cs
- ByteAnimation.cs
- CheckPair.cs
- DataGridViewEditingControlShowingEventArgs.cs
- Or.cs
- HtmlAnchor.cs
- EncodingInfo.cs
- DropShadowBitmapEffect.cs
- BufferModeSettings.cs
- SmtpMail.cs