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
- StringOutput.cs
- HtmlInputHidden.cs
- NavigatingCancelEventArgs.cs
- SchemaTypeEmitter.cs
- ThreadStateException.cs
- Utils.cs
- OdbcEnvironment.cs
- HandledMouseEvent.cs
- WindowsIdentity.cs
- RectAnimation.cs
- BufferedStream.cs
- __Error.cs
- RuleSettings.cs
- NamedPipeHostedTransportConfiguration.cs
- ConfigXmlSignificantWhitespace.cs
- RoutedUICommand.cs
- WebPartConnectionsDisconnectVerb.cs
- MimeWriter.cs
- PersonalizationStateInfo.cs
- ApplicationDirectory.cs
- PropertyGroupDescription.cs
- HttpAsyncResult.cs
- SevenBitStream.cs
- TextFormatterImp.cs
- X509WindowsSecurityToken.cs
- PasswordDeriveBytes.cs
- VersionedStream.cs
- WebPartCollection.cs
- basevalidator.cs
- DataServiceSaveChangesEventArgs.cs
- ObjectDataProvider.cs
- Table.cs
- StatusBarItemAutomationPeer.cs
- ExpressionQuoter.cs
- KerberosTokenFactoryCredential.cs
- ViewManager.cs
- FileSystemEnumerable.cs
- altserialization.cs
- Transform3DGroup.cs
- TransformPatternIdentifiers.cs
- TimeoutTimer.cs
- CreateUserWizardStep.cs
- MessageDirection.cs
- AmbientProperties.cs
- DataStorage.cs
- SqlSupersetValidator.cs
- WindowsFormsHelpers.cs
- GeneralTransform3DTo2DTo3D.cs
- HttpPostLocalhostServerProtocol.cs
- QuaternionConverter.cs
- ProxyElement.cs
- Binding.cs
- IPHostEntry.cs
- TableLayoutSettings.cs
- RegexMatchCollection.cs
- InheritanceService.cs
- EncryptedKeyIdentifierClause.cs
- XmlName.cs
- RelationshipEntry.cs
- X509CertificateStore.cs
- RawUIStateInputReport.cs
- DataGridColumn.cs
- DataGridPageChangedEventArgs.cs
- RegexParser.cs
- DataObjectEventArgs.cs
- ScriptHandlerFactory.cs
- StringOutput.cs
- DiscreteKeyFrames.cs
- UnsafeNativeMethods.cs
- DbRetry.cs
- SystemIPAddressInformation.cs
- RegistryConfigurationProvider.cs
- ToolStripLocationCancelEventArgs.cs
- GuidTagList.cs
- ClientSettingsStore.cs
- ThumbButtonInfoCollection.cs
- CacheOutputQuery.cs
- ScriptingJsonSerializationSection.cs
- RSACryptoServiceProvider.cs
- DocumentPageView.cs
- HostingPreferredMapPath.cs
- SelectionRange.cs
- SecurityKeyIdentifier.cs
- SmtpFailedRecipientException.cs
- StructuredTypeEmitter.cs
- PublisherIdentityPermission.cs
- SaveFileDialog.cs
- DrawingAttributesDefaultValueFactory.cs
- webproxy.cs
- ClusterRegistryConfigurationProvider.cs
- InstalledVoice.cs
- CompilationSection.cs
- Path.cs
- InplaceBitmapMetadataWriter.cs
- BaseInfoTable.cs
- ShaperBuffers.cs
- SymbolEqualComparer.cs
- NumericUpDown.cs
- AlphabeticalEnumConverter.cs
- DataContractSerializerOperationGenerator.cs