Code:
/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / ndp / fx / src / xsp / System / Web / UI / WebControls / ErrorTableItemStyle.cs / 2 / ErrorTableItemStyle.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Web.UI.WebControls { using System; using System.ComponentModel; using System.Drawing; // A derived TableItemStyle class with the default ForeColor set to Color.Red instead of Color.Empty internal sealed class ErrorTableItemStyle : TableItemStyle, ICustomTypeDescriptor { public ErrorTableItemStyle() : 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 } }
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- BevelBitmapEffect.cs
- ObjectPersistData.cs
- SendKeys.cs
- TextOutput.cs
- AssemblyAssociatedContentFileAttribute.cs
- ChildrenQuery.cs
- GridViewRowCollection.cs
- HwndHostAutomationPeer.cs
- XmlObjectSerializer.cs
- _KerberosClient.cs
- SchemaSetCompiler.cs
- DataGridViewAdvancedBorderStyle.cs
- XmlCDATASection.cs
- Grammar.cs
- ImpersonationContext.cs
- MetaDataInfo.cs
- DbModificationClause.cs
- ToolStripSeparatorRenderEventArgs.cs
- AutomationPattern.cs
- safemediahandle.cs
- TCPClient.cs
- StaticFileHandler.cs
- SupportsEventValidationAttribute.cs
- RsaEndpointIdentity.cs
- Parser.cs
- StyleTypedPropertyAttribute.cs
- HttpModule.cs
- Knowncolors.cs
- CodeMemberField.cs
- ErrorEventArgs.cs
- SQLBytes.cs
- Vector.cs
- ToolStripDropTargetManager.cs
- NumberAction.cs
- ListSourceHelper.cs
- RegexNode.cs
- ClientRuntimeConfig.cs
- ImageList.cs
- SqlDataSourceDesigner.cs
- TextChange.cs
- InputProcessorProfilesLoader.cs
- DataGridViewColumnCollectionEditor.cs
- ApplicationSecurityManager.cs
- OracleConnection.cs
- DataKey.cs
- Camera.cs
- ByteArrayHelperWithString.cs
- CommandManager.cs
- TableHeaderCell.cs
- _LocalDataStore.cs
- SqlGenericUtil.cs
- PageThemeBuildProvider.cs
- Point4DConverter.cs
- InProcStateClientManager.cs
- ShutDownListener.cs
- Geometry3D.cs
- EntitySetRetriever.cs
- DataServiceBehavior.cs
- StreamAsIStream.cs
- PageThemeBuildProvider.cs
- TokenBasedSetEnumerator.cs
- UnmanagedHandle.cs
- EventProxy.cs
- DesignTimeTemplateParser.cs
- AnimatedTypeHelpers.cs
- dataSvcMapFileLoader.cs
- ProtocolsConfiguration.cs
- PhysicalAddress.cs
- PolyBezierSegment.cs
- IconBitmapDecoder.cs
- SafeFileMappingHandle.cs
- SiteMapNodeCollection.cs
- TrustManagerMoreInformation.cs
- WindowsScroll.cs
- ConfigurationPermission.cs
- MemberPathMap.cs
- Expr.cs
- PathFigure.cs
- VirtualStackFrame.cs
- EmbeddedMailObject.cs
- WebPartCatalogAddVerb.cs
- XLinq.cs
- SqlRewriteScalarSubqueries.cs
- ConsumerConnectionPoint.cs
- DispatcherEventArgs.cs
- SqlUdtInfo.cs
- BrowserInteropHelper.cs
- HMAC.cs
- DataSourceCacheDurationConverter.cs
- RootProfilePropertySettingsCollection.cs
- Annotation.cs
- WebConfigurationHost.cs
- HostingEnvironment.cs
- FileDialog_Vista.cs
- TypeValidationEventArgs.cs
- SmtpSection.cs
- Ref.cs
- NumericPagerField.cs
- ToolStripSplitStackLayout.cs
- NavigationWindow.cs