Code:
/ FXUpdate3074 / FXUpdate3074 / 1.1 / untmp / whidbey / QFE / ndp / fx / src / xsp / System / Web / UI / WebControls / ErrorStyle.cs / 2 / ErrorStyle.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Web.UI.WebControls { using System; using System.Collections; using System.ComponentModel; using System.ComponentModel.Design; using System.Drawing; // A derived Style class with the default ForeColor set to Color.Red instead of Color.Empty internal sealed class ErrorStyle : Style, ICustomTypeDescriptor { public ErrorStyle() : base() { ForeColor = Color.Red; } #region ICustomTypeDesciptor implementation AttributeCollection ICustomTypeDescriptor.GetAttributes() { return TypeDescriptor.GetAttributes(this, true); } string ICustomTypeDescriptor.GetClassName() { return TypeDescriptor.GetClassName(this, true); } string ICustomTypeDescriptor.GetComponentName() { return TypeDescriptor.GetComponentName(this, true); } TypeConverter ICustomTypeDescriptor.GetConverter() { return TypeDescriptor.GetConverter(this, true); } EventDescriptor ICustomTypeDescriptor.GetDefaultEvent() { return TypeDescriptor.GetDefaultEvent(this, true); } PropertyDescriptor ICustomTypeDescriptor.GetDefaultProperty() { return TypeDescriptor.GetDefaultProperty(this, true); } object ICustomTypeDescriptor.GetEditor(Type editorBaseType) { return TypeDescriptor.GetEditor(this, editorBaseType, true); } EventDescriptorCollection ICustomTypeDescriptor.GetEvents() { return TypeDescriptor.GetEvents(this, true); } EventDescriptorCollection ICustomTypeDescriptor.GetEvents(Attribute[] attributes) { return TypeDescriptor.GetEvents(this, attributes, true); } PropertyDescriptorCollection ICustomTypeDescriptor.GetProperties() { return ((ICustomTypeDescriptor)this).GetProperties(null); } PropertyDescriptorCollection ICustomTypeDescriptor.GetProperties(Attribute[] attributes) { PropertyDescriptorCollection oldProperties = TypeDescriptor.GetProperties(GetType(), attributes); PropertyDescriptor[] newProperties = new PropertyDescriptor[oldProperties.Count]; PropertyDescriptor foreColor = oldProperties["ForeColor"]; for (int i=0; i < oldProperties.Count; i++) { PropertyDescriptor property = oldProperties[i]; if (property == foreColor) { newProperties[i] = TypeDescriptor.CreateProperty( GetType(), property, new DefaultValueAttribute(typeof(Color), "Red")); } else { newProperties[i] = property; } } return new PropertyDescriptorCollection(newProperties, true); } object ICustomTypeDescriptor.GetPropertyOwner(PropertyDescriptor pd) { return this; } #endregion //ICustomTypeDescriptor implementation } } // 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
- DataSourceControlBuilder.cs
- RegexCompiler.cs
- DictionaryCustomTypeDescriptor.cs
- UpDownBase.cs
- Identity.cs
- WithStatement.cs
- XmlSchemaSimpleContent.cs
- EntityDesignerUtils.cs
- InputEventArgs.cs
- ExpandSegment.cs
- TargetInvocationException.cs
- ConfigXmlAttribute.cs
- DropAnimation.xaml.cs
- TemplateApplicationHelper.cs
- ExtensibleClassFactory.cs
- CanonicalizationDriver.cs
- StrokeCollection2.cs
- ProviderConnectionPoint.cs
- ColorPalette.cs
- ReverseInheritProperty.cs
- BindingOperations.cs
- SafeMemoryMappedFileHandle.cs
- RadioButtonStandardAdapter.cs
- NonPrimarySelectionGlyph.cs
- xmlglyphRunInfo.cs
- ContextMenuService.cs
- CompilerScope.Storage.cs
- MetabaseSettings.cs
- ClassHandlersStore.cs
- WsdlImporter.cs
- SafePointer.cs
- ClientTargetCollection.cs
- XamlVector3DCollectionSerializer.cs
- EngineSite.cs
- RemoteWebConfigurationHost.cs
- HostedImpersonationContext.cs
- SplineQuaternionKeyFrame.cs
- PageBuildProvider.cs
- TemplateApplicationHelper.cs
- CodeGen.cs
- DoubleConverter.cs
- SEHException.cs
- Deserializer.cs
- FunctionDetailsReader.cs
- RegistrySecurity.cs
- AnchorEditor.cs
- MailBnfHelper.cs
- SchemaMapping.cs
- _TLSstream.cs
- FileDialog_Vista_Interop.cs
- diagnosticsswitches.cs
- UIElementParaClient.cs
- Propagator.Evaluator.cs
- SmtpCommands.cs
- DataRowChangeEvent.cs
- AsyncOperationManager.cs
- PersistChildrenAttribute.cs
- CqlLexerHelpers.cs
- XmlStringTable.cs
- ServiceModelExtensionCollectionElement.cs
- DeferrableContentConverter.cs
- COM2ExtendedUITypeEditor.cs
- SecurityHelper.cs
- MemberPathMap.cs
- DiagnosticEventProvider.cs
- ConfigurationElementCollection.cs
- NonClientArea.cs
- SystemMulticastIPAddressInformation.cs
- ProtocolsSection.cs
- CompositeActivityCodeGenerator.cs
- BinaryFormatter.cs
- SubqueryRules.cs
- BrowserDefinitionCollection.cs
- RouteItem.cs
- StylusShape.cs
- SymmetricKeyWrap.cs
- Speller.cs
- HttpRuntime.cs
- Menu.cs
- UnsafeNativeMethods.cs
- SHA512CryptoServiceProvider.cs
- ByteConverter.cs
- ElementProxy.cs
- ConfigXmlWhitespace.cs
- MailWriter.cs
- COM2Enum.cs
- UserUseLicenseDictionaryLoader.cs
- MatrixIndependentAnimationStorage.cs
- FunctionImportMapping.ReturnTypeRenameMapping.cs
- DocumentApplicationJournalEntry.cs
- BufferAllocator.cs
- WindowsScroll.cs
- formatter.cs
- EventProxy.cs
- FormattedText.cs
- DelimitedListTraceListener.cs
- InfoCardTraceRecord.cs
- CategoryAttribute.cs
- MultitargetingHelpers.cs
- XPathDocument.cs