Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / WinForms / Managed / System / WinForms / DataGridDefaultColumnWidthTypeConverter.cs / 1305376 / DataGridDefaultColumnWidthTypeConverter.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 System; using System.IO; using System.ComponentModel; using Microsoft.Win32; using System.Globalization; ////// /// public class DataGridPreferredColumnWidthTypeConverter : TypeConverter { ///[To be supplied.] ////// /// public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType) { if (sourceType == typeof(string) || sourceType == typeof(int)) return true; else return false; } ///[To be supplied.] ////// /// public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) { if (destinationType == typeof(string)) { if (value.GetType() == typeof(int)) { int pulica = (int) value; if (pulica == - 1) return "AutoColumnResize (-1)"; else return pulica.ToString(CultureInfo.CurrentCulture); } else { return base.ConvertTo(context, culture, value, destinationType); } } else return base.ConvertTo(context, culture, value, destinationType); } ///[To be supplied.] ////// /// public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) { if (value.GetType() == typeof(string)) { string text = value.ToString(); if (text.Equals("AutoColumnResize (-1)")) return -1; else return Int32.Parse(text, CultureInfo.CurrentCulture); } else if (value.GetType() == typeof(int)) { return (int)value; } else { throw GetConvertFromException(value); } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ //[To be supplied.] ///// 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 System; using System.IO; using System.ComponentModel; using Microsoft.Win32; using System.Globalization; ////// /// public class DataGridPreferredColumnWidthTypeConverter : TypeConverter { ///[To be supplied.] ////// /// public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType) { if (sourceType == typeof(string) || sourceType == typeof(int)) return true; else return false; } ///[To be supplied.] ////// /// public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) { if (destinationType == typeof(string)) { if (value.GetType() == typeof(int)) { int pulica = (int) value; if (pulica == - 1) return "AutoColumnResize (-1)"; else return pulica.ToString(CultureInfo.CurrentCulture); } else { return base.ConvertTo(context, culture, value, destinationType); } } else return base.ConvertTo(context, culture, value, destinationType); } ///[To be supplied.] ////// /// public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) { if (value.GetType() == typeof(string)) { string text = value.ToString(); if (text.Equals("AutoColumnResize (-1)")) return -1; else return Int32.Parse(text, CultureInfo.CurrentCulture); } else if (value.GetType() == typeof(int)) { return (int)value; } else { throw GetConvertFromException(value); } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.[To be supplied.] ///
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- AVElementHelper.cs
- ToolStripManager.cs
- BindingContext.cs
- AttachmentService.cs
- ConnectionManagementElement.cs
- DSASignatureFormatter.cs
- ListViewGroupConverter.cs
- DictionaryEntry.cs
- HelpKeywordAttribute.cs
- CmsInterop.cs
- HandlerBase.cs
- BuilderInfo.cs
- OdbcCommandBuilder.cs
- OperatorExpressions.cs
- LinqDataSourceContextEventArgs.cs
- SystemIPInterfaceStatistics.cs
- ScrollContentPresenter.cs
- PipelineComponent.cs
- ChangeBlockUndoRecord.cs
- TcpConnectionPoolSettingsElement.cs
- lengthconverter.cs
- TableParaClient.cs
- UpdateException.cs
- versioninfo.cs
- AuthenticatingEventArgs.cs
- filewebrequest.cs
- PackageDigitalSignature.cs
- StylusDownEventArgs.cs
- Vector3DAnimation.cs
- BitmapFrame.cs
- ArrayList.cs
- LinqToSqlWrapper.cs
- XhtmlBasicListAdapter.cs
- XNodeNavigator.cs
- Drawing.cs
- FamilyMapCollection.cs
- ListViewTableRow.cs
- DropShadowBitmapEffect.cs
- PackagePart.cs
- DialogWindow.cs
- TraceLog.cs
- InheritanceAttribute.cs
- MsmqMessage.cs
- HiddenFieldPageStatePersister.cs
- WindowsFormsHostPropertyMap.cs
- UnitySerializationHolder.cs
- WhitespaceReader.cs
- EventWaitHandle.cs
- PropertyFilterAttribute.cs
- XmlSchemaSearchPattern.cs
- DrawingAttributeSerializer.cs
- DataObject.cs
- Floater.cs
- XmlSerializationWriter.cs
- XmlReflectionMember.cs
- TextEditorContextMenu.cs
- ValidationHelper.cs
- DebugView.cs
- ChildTable.cs
- HashCodeCombiner.cs
- AssociationSetMetadata.cs
- TimeSpanStorage.cs
- DependencyPropertyAttribute.cs
- CustomCredentialPolicy.cs
- ContextStack.cs
- CloudCollection.cs
- UdpConstants.cs
- QualificationDataItem.cs
- HttpException.cs
- SystemInformation.cs
- CodeDOMProvider.cs
- DesignerAttribute.cs
- FormClosedEvent.cs
- SchemaType.cs
- RadialGradientBrush.cs
- XmlCharacterData.cs
- ScriptComponentDescriptor.cs
- RSAPKCS1KeyExchangeDeformatter.cs
- StateDesigner.Helpers.cs
- sortedlist.cs
- WebBrowserDocumentCompletedEventHandler.cs
- CodeCastExpression.cs
- PerfCounterSection.cs
- BoundsDrawingContextWalker.cs
- ListViewPagedDataSource.cs
- MultiView.cs
- ModifierKeysValueSerializer.cs
- AnnotationHighlightLayer.cs
- RegistryKey.cs
- ResourceSetExpression.cs
- XmlQueryOutput.cs
- PassportAuthenticationModule.cs
- InputMethodStateTypeInfo.cs
- DesignerSerializationOptionsAttribute.cs
- SqlClientWrapperSmiStream.cs
- DbMetaDataCollectionNames.cs
- StyleSelector.cs
- ToolstripProfessionalRenderer.cs
- DetailsViewUpdateEventArgs.cs
- DelayedRegex.cs