Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / ndp / fx / src / xsp / System / Web / UI / WebControls / ErrorTableItemStyle.cs / 1 / 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 } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ //// 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 } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- EntityKey.cs
- MergeFilterQuery.cs
- XmlSecureResolver.cs
- MemberMemberBinding.cs
- Model3DCollection.cs
- WindowsBrush.cs
- PageStatePersister.cs
- Substitution.cs
- RulePatternOps.cs
- StatusBarPanelClickEvent.cs
- TextParagraphCache.cs
- CounterCreationData.cs
- __Filters.cs
- ObjectDisposedException.cs
- TreeViewImageIndexConverter.cs
- ToolStripDropDownMenu.cs
- CompiledRegexRunner.cs
- NamespaceEmitter.cs
- WebServiceErrorEvent.cs
- NativeMethods.cs
- TryExpression.cs
- IndentedWriter.cs
- ReferenceTypeElement.cs
- UniqueCodeIdentifierScope.cs
- Comparer.cs
- ErrorFormatter.cs
- EntityDataSourceContainerNameConverter.cs
- PrimitiveSchema.cs
- UserNameSecurityTokenProvider.cs
- SamlSubjectStatement.cs
- CodeObject.cs
- SQLSingle.cs
- GroupBox.cs
- NumberAction.cs
- HTMLTextWriter.cs
- ModelUIElement3D.cs
- StringReader.cs
- PenLineJoinValidation.cs
- ToolStripScrollButton.cs
- DataGridViewButtonCell.cs
- ApplicationBuildProvider.cs
- Translator.cs
- UpdateCompiler.cs
- JsonGlobals.cs
- CustomErrorCollection.cs
- ToolStripSystemRenderer.cs
- NeutralResourcesLanguageAttribute.cs
- DataGridViewColumnEventArgs.cs
- TableFieldsEditor.cs
- RootAction.cs
- ScriptControl.cs
- InkCanvasFeedbackAdorner.cs
- CompositionCommandSet.cs
- FixedSOMPage.cs
- EventPrivateKey.cs
- DynamicDataRoute.cs
- RenderOptions.cs
- PropertyInfoSet.cs
- ToolboxBitmapAttribute.cs
- NullableLongAverageAggregationOperator.cs
- ReturnType.cs
- Deflater.cs
- AggregateNode.cs
- WorkerRequest.cs
- DictionaryContent.cs
- XmlChildNodes.cs
- Point3DIndependentAnimationStorage.cs
- SrgsOneOf.cs
- BigInt.cs
- FormsAuthenticationEventArgs.cs
- WebAdminConfigurationHelper.cs
- GPStream.cs
- TextEndOfLine.cs
- CounterSetInstanceCounterDataSet.cs
- RepeaterCommandEventArgs.cs
- PropertyGridView.cs
- HashCryptoHandle.cs
- FilteredSchemaElementLookUpTable.cs
- GetChildSubtree.cs
- SqlErrorCollection.cs
- IgnoreFlushAndCloseStream.cs
- FileNotFoundException.cs
- UpdateManifestForBrowserApplication.cs
- StrongNameSignatureInformation.cs
- PackagePartCollection.cs
- listitem.cs
- TextRunTypographyProperties.cs
- CodePageUtils.cs
- DataGridViewToolTip.cs
- ToolStripManager.cs
- TextElementCollectionHelper.cs
- ApplicationCommands.cs
- Misc.cs
- WriteTimeStream.cs
- ObjectTag.cs
- MiniMapControl.xaml.cs
- ISAPIWorkerRequest.cs
- MarginsConverter.cs
- NativeRecognizer.cs
- WindowCollection.cs