Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / ndp / fx / src / WinForms / Managed / System / WinForms / DataGridViewColumnConverter.cs / 1 / DataGridViewColumnConverter.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.Drawing; using System.Diagnostics; using System.Globalization; using System.Reflection; internal class DataGridViewColumnConverter : ExpandableObjectConverter { public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType) { if (destinationType == typeof(InstanceDescriptor)) { return true; } return base.CanConvertTo(context, destinationType); } ////// 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"); } DataGridViewColumn dataGridViewColumn = value as DataGridViewColumn; if (destinationType == typeof(InstanceDescriptor) && dataGridViewColumn != null) { ConstructorInfo ctor; // public DataGridViewColumn(Type cellType) // if (dataGridViewColumn.CellType != null) { ctor = dataGridViewColumn.GetType().GetConstructor(new Type[] { typeof(Type) }); if (ctor != null) { return new InstanceDescriptor(ctor, new object[] { dataGridViewColumn.CellType }, false); } } // public DataGridViewColumn() // ctor = dataGridViewColumn.GetType().GetConstructor(new Type[0]); if (ctor != null) { 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.Drawing; using System.Diagnostics; using System.Globalization; using System.Reflection; internal class DataGridViewColumnConverter : ExpandableObjectConverter { public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType) { if (destinationType == typeof(InstanceDescriptor)) { return true; } return base.CanConvertTo(context, destinationType); } ////// 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"); } DataGridViewColumn dataGridViewColumn = value as DataGridViewColumn; if (destinationType == typeof(InstanceDescriptor) && dataGridViewColumn != null) { ConstructorInfo ctor; // public DataGridViewColumn(Type cellType) // if (dataGridViewColumn.CellType != null) { ctor = dataGridViewColumn.GetType().GetConstructor(new Type[] { typeof(Type) }); if (ctor != null) { return new InstanceDescriptor(ctor, new object[] { dataGridViewColumn.CellType }, false); } } // public DataGridViewColumn() // ctor = dataGridViewColumn.GetType().GetConstructor(new Type[0]); if (ctor != null) { 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
- CodeTypeMember.cs
- TraceData.cs
- ToolStripLocationCancelEventArgs.cs
- ExpandedWrapper.cs
- Environment.cs
- LongTypeConverter.cs
- SetStateEventArgs.cs
- DataGridViewLinkColumn.cs
- CodeCompiler.cs
- DataPagerField.cs
- AnnotationResourceChangedEventArgs.cs
- ConnectionDemuxer.cs
- ObservableCollectionDefaultValueFactory.cs
- WindowsTokenRoleProvider.cs
- SuppressMessageAttribute.cs
- AppSettingsSection.cs
- BitmapEffectOutputConnector.cs
- HtmlInputCheckBox.cs
- SpecialTypeDataContract.cs
- StaticDataManager.cs
- Validator.cs
- InternalRelationshipCollection.cs
- Vector3DCollection.cs
- Blend.cs
- StreamGeometry.cs
- RoleGroupCollection.cs
- ReferencedCollectionType.cs
- NonVisualControlAttribute.cs
- XmlAttributes.cs
- HtmlPanelAdapter.cs
- DecimalAverageAggregationOperator.cs
- IItemProperties.cs
- GrabHandleGlyph.cs
- DataBinding.cs
- NumberSubstitution.cs
- _SslStream.cs
- SharedStatics.cs
- Rect3DValueSerializer.cs
- CompleteWizardStep.cs
- BinaryNode.cs
- ChildrenQuery.cs
- CodeAccessPermission.cs
- ContextMenuAutomationPeer.cs
- XamlSerializerUtil.cs
- WindowsAuthenticationEventArgs.cs
- OutputCacheSettings.cs
- Stroke.cs
- HitTestParameters3D.cs
- XamlTreeBuilderBamlRecordWriter.cs
- XmlIlTypeHelper.cs
- EncryptedHeader.cs
- EnumDataContract.cs
- StyleReferenceConverter.cs
- StaticSiteMapProvider.cs
- DataQuery.cs
- Maps.cs
- ThreadAttributes.cs
- MailFileEditor.cs
- GcHandle.cs
- Formatter.cs
- ParserOptions.cs
- DataGridViewAdvancedBorderStyle.cs
- PenContext.cs
- CheckBoxStandardAdapter.cs
- DatagridviewDisplayedBandsData.cs
- MultipleViewPattern.cs
- XmlDictionaryString.cs
- SelectionRangeConverter.cs
- PeerApplicationLaunchInfo.cs
- DataGridViewTextBoxCell.cs
- EDesignUtil.cs
- StringArrayConverter.cs
- ProviderConnectionPoint.cs
- SqlCommandBuilder.cs
- SqlUserDefinedAggregateAttribute.cs
- MD5.cs
- XD.cs
- ScrollBar.cs
- ToolBarButton.cs
- SqlMetaData.cs
- basecomparevalidator.cs
- Vector3DAnimationBase.cs
- IChannel.cs
- PageAdapter.cs
- EventLogSession.cs
- CompilerParameters.cs
- ContractsBCL.cs
- Ops.cs
- xsdvalidator.cs
- ApplicationProxyInternal.cs
- GlyphInfoList.cs
- TextDecorationCollection.cs
- PriorityRange.cs
- ItemMap.cs
- FontUnitConverter.cs
- GlyphRun.cs
- DesignerForm.cs
- CRYPTPROTECT_PROMPTSTRUCT.cs
- HtmlHead.cs
- ProfileProvider.cs