Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / ndp / fx / src / WinForms / Managed / System / WinForms / DataGridViewCellStyleConverter.cs / 1 / DataGridViewCellStyleConverter.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- /* */ namespace System.Windows.Forms { using System.Runtime.Serialization.Formatters; using System.Runtime.Remoting; using System.Runtime.InteropServices; using Microsoft.Win32; using System.Collections; using System.ComponentModel; using System.ComponentModel.Design.Serialization; using System.Diagnostics; using System.Globalization; using System.Reflection; ////// /// public class DataGridViewCellStyleConverter : TypeConverter { ////// /// public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType) { if (destinationType == typeof(InstanceDescriptor)) { return true; } return base.CanConvertTo(context, destinationType); } ///Gets a value indicating whether this converter can /// convert an object to the given destination type using the context. ////// /// Converts the given object to another type. The most common types to convert /// are to and from a string object. The default implementation will make a call /// to ToString on the object if the object is valid and if the destination /// type is string. If this cannot convert to the desitnation type, this will /// throw a NotSupportedException. /// public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) { if (destinationType == null) { throw new ArgumentNullException("destinationType"); } if (destinationType == typeof(InstanceDescriptor) && value is DataGridViewCellStyle) { ConstructorInfo ctor = value.GetType().GetConstructor(new Type[0]); return new InstanceDescriptor(ctor, new object[0], false); } return base.ConvertTo(context, culture, value, destinationType); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- /* */ namespace System.Windows.Forms { using System.Runtime.Serialization.Formatters; using System.Runtime.Remoting; using System.Runtime.InteropServices; using Microsoft.Win32; using System.Collections; using System.ComponentModel; using System.ComponentModel.Design.Serialization; using System.Diagnostics; using System.Globalization; using System.Reflection; ////// /// public class DataGridViewCellStyleConverter : TypeConverter { ////// /// public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType) { if (destinationType == typeof(InstanceDescriptor)) { return true; } return base.CanConvertTo(context, destinationType); } ///Gets a value indicating whether this converter can /// convert an object to the given destination type using the context. ////// /// Converts the given object to another type. The most common types to convert /// are to and from a string object. The default implementation will make a call /// to ToString on the object if the object is valid and if the destination /// type is string. If this cannot convert to the desitnation type, this will /// throw a NotSupportedException. /// public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) { if (destinationType == null) { throw new ArgumentNullException("destinationType"); } if (destinationType == typeof(InstanceDescriptor) && value is DataGridViewCellStyle) { ConstructorInfo ctor = value.GetType().GetConstructor(new Type[0]); return new InstanceDescriptor(ctor, new object[0], false); } return base.ConvertTo(context, culture, value, destinationType); } } } // 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
- DateTimeSerializationSection.cs
- XmlIgnoreAttribute.cs
- ComPlusServiceLoader.cs
- BamlLocalizer.cs
- AutomationPropertyInfo.cs
- FontFamilyConverter.cs
- Variant.cs
- Classification.cs
- SqlCommand.cs
- ModulesEntry.cs
- WmlTextBoxAdapter.cs
- MatrixAnimationUsingPath.cs
- ParameterReplacerVisitor.cs
- ProcessHostServerConfig.cs
- BinaryCommonClasses.cs
- OrCondition.cs
- XmlHierarchicalEnumerable.cs
- HtmlInputRadioButton.cs
- DataGridViewCheckBoxCell.cs
- ScrollViewerAutomationPeer.cs
- CorruptingExceptionCommon.cs
- SQLBytesStorage.cs
- HttpSessionStateWrapper.cs
- NodeInfo.cs
- SignatureDescription.cs
- WebPartVerbCollection.cs
- Helper.cs
- BitmapDownload.cs
- OrderByBuilder.cs
- ExtendedProtectionPolicyElement.cs
- XPathDocumentNavigator.cs
- JsonQueryStringConverter.cs
- CssTextWriter.cs
- PersistChildrenAttribute.cs
- CompressionTransform.cs
- ResourceDefaultValueAttribute.cs
- HttpPostedFileWrapper.cs
- PolyLineSegment.cs
- FieldNameLookup.cs
- JavaScriptSerializer.cs
- XmlReflectionImporter.cs
- Types.cs
- ItemChangedEventArgs.cs
- TextOnlyOutput.cs
- UriExt.cs
- TableSectionStyle.cs
- RequestCache.cs
- ModifierKeysConverter.cs
- RsaSecurityKey.cs
- EntityWrapper.cs
- TypedDataSourceCodeGenerator.cs
- UpdateException.cs
- UrlMapping.cs
- ComPlusServiceLoader.cs
- HttpApplication.cs
- AtomMaterializerLog.cs
- Utils.cs
- XmlSerializerAssemblyAttribute.cs
- SqlConnectionHelper.cs
- ExpressionBuilderContext.cs
- serverconfig.cs
- NameValueConfigurationCollection.cs
- HostingEnvironmentSection.cs
- AddDataControlFieldDialog.cs
- NetTcpSection.cs
- MultitargetUtil.cs
- SRef.cs
- SimpleModelProvider.cs
- hresults.cs
- WriteableOnDemandStream.cs
- RankException.cs
- LoadedOrUnloadedOperation.cs
- XmlHierarchicalDataSourceView.cs
- GifBitmapEncoder.cs
- ObjectHelper.cs
- SmiContextFactory.cs
- CodeTypeReferenceCollection.cs
- SmtpSection.cs
- LocatorGroup.cs
- GPPOINT.cs
- ContentControl.cs
- SharedDp.cs
- SplineQuaternionKeyFrame.cs
- DataGrid.cs
- XmlDocumentSerializer.cs
- FileDialog.cs
- MruCache.cs
- AttributeQuery.cs
- Automation.cs
- AccessText.cs
- AspNetSynchronizationContext.cs
- ImportOptions.cs
- BatchParser.cs
- FamilyCollection.cs
- EdmItemCollection.cs
- PeerNodeAddress.cs
- FrameworkElementFactory.cs
- ListViewDeletedEventArgs.cs
- SelectedGridItemChangedEvent.cs
- localization.cs