Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / 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
- JavascriptCallbackBehaviorAttribute.cs
- LinqExpressionNormalizer.cs
- XamlSerializerUtil.cs
- HttpConfigurationSystem.cs
- NullableDoubleSumAggregationOperator.cs
- HorizontalAlignConverter.cs
- ProgressChangedEventArgs.cs
- CodeDomSerializerException.cs
- ColumnMap.cs
- TreeNodeCollection.cs
- VoiceInfo.cs
- WmfPlaceableFileHeader.cs
- ImpersonationContext.cs
- Camera.cs
- ExecutorLocksHeldException.cs
- OpenFileDialog.cs
- HtmlTitle.cs
- ConnectionProviderAttribute.cs
- coordinator.cs
- Compress.cs
- ToolStripPanelRenderEventArgs.cs
- PropertyGrid.cs
- CommandPlan.cs
- DesignerTransactionCloseEvent.cs
- StringResourceManager.cs
- MappedMetaModel.cs
- ColumnMapTranslator.cs
- Queue.cs
- ScrollContentPresenter.cs
- TransformGroup.cs
- StateInitializationDesigner.cs
- GeneralTransform3DCollection.cs
- ClientTarget.cs
- DbSetClause.cs
- EventToken.cs
- MexHttpsBindingCollectionElement.cs
- ServiceReference.cs
- XPathNavigatorKeyComparer.cs
- XPathNode.cs
- WebPartEventArgs.cs
- ResourceExpression.cs
- KoreanLunisolarCalendar.cs
- MissingSatelliteAssemblyException.cs
- UInt32.cs
- DrawingImage.cs
- XmlDsigSep2000.cs
- TraceContextRecord.cs
- ConfigurationSectionGroup.cs
- WebPartAddingEventArgs.cs
- PathFigureCollection.cs
- ObjectFactoryCodeDomTreeGenerator.cs
- HtmlShimManager.cs
- OracleSqlParser.cs
- TextParentUndoUnit.cs
- DesignerLinkAdapter.cs
- FileVersion.cs
- SpotLight.cs
- Filter.cs
- WorkflowServiceHost.cs
- MonthChangedEventArgs.cs
- PageBreakRecord.cs
- GridViewCommandEventArgs.cs
- AnonymousIdentificationModule.cs
- RsaSecurityKey.cs
- SafeRightsManagementHandle.cs
- RestHandlerFactory.cs
- SmiMetaData.cs
- RegexCharClass.cs
- RangeBaseAutomationPeer.cs
- Registration.cs
- XmlDocumentType.cs
- XmlILStorageConverter.cs
- TableLayoutCellPaintEventArgs.cs
- TrustManagerMoreInformation.cs
- Attributes.cs
- ResourceDisplayNameAttribute.cs
- BuilderInfo.cs
- DataControlPagerLinkButton.cs
- DataIdProcessor.cs
- OracleConnectionFactory.cs
- MenuItemStyle.cs
- WindowsComboBox.cs
- ArrangedElement.cs
- SessionEndingEventArgs.cs
- HtmlForm.cs
- StandardOleMarshalObject.cs
- PresentationTraceSources.cs
- SpecialFolderEnumConverter.cs
- SQLGuid.cs
- ProfilePropertySettingsCollection.cs
- TableRow.cs
- DataSourceDescriptorCollection.cs
- TextEffectResolver.cs
- SqlWebEventProvider.cs
- WebPartEventArgs.cs
- ControlAdapter.cs
- XmlException.cs
- RawMouseInputReport.cs
- DefaultProxySection.cs
- InternalsVisibleToAttribute.cs