Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / ndp / fx / src / WinForms / Managed / System / WinForms / DataGridDefaultColumnWidthTypeConverter.cs / 1 / 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
- WebScriptServiceHost.cs
- TextRenderer.cs
- EntitySetBaseCollection.cs
- XslVisitor.cs
- CodeDirectoryCompiler.cs
- NameValueFileSectionHandler.cs
- XmlFormatExtensionPointAttribute.cs
- TextDecorationCollectionConverter.cs
- ExceptionUtil.cs
- SelectionEditor.cs
- EntityProviderServices.cs
- Buffer.cs
- OracleConnection.cs
- IPGlobalProperties.cs
- ColorTransform.cs
- ToolStripContentPanel.cs
- PhysicalFontFamily.cs
- SQLStringStorage.cs
- _BaseOverlappedAsyncResult.cs
- InvokeBinder.cs
- SmtpNtlmAuthenticationModule.cs
- ArgIterator.cs
- ReadOnlyMetadataCollection.cs
- TableCellAutomationPeer.cs
- ClientScriptManager.cs
- WebControlAdapter.cs
- XmlSchemaComplexContentExtension.cs
- UnsafeNativeMethods.cs
- DecoderExceptionFallback.cs
- HiddenField.cs
- DataControlButton.cs
- PageAdapter.cs
- SystemResourceKey.cs
- CreateParams.cs
- PickBranchDesigner.xaml.cs
- XmlObjectSerializerReadContextComplex.cs
- CachedRequestParams.cs
- HttpListenerRequest.cs
- ValueChangedEventManager.cs
- TableRowGroupCollection.cs
- IISMapPath.cs
- InputGestureCollection.cs
- SchemaManager.cs
- LineUtil.cs
- MimeFormReflector.cs
- D3DImage.cs
- DataGridTextBox.cs
- ValidateNames.cs
- AnonymousIdentificationModule.cs
- TraceProvider.cs
- SchemaNames.cs
- Frame.cs
- ThreadStateException.cs
- NativeMethods.cs
- BitmapEffectGroup.cs
- XslCompiledTransform.cs
- ProcessInfo.cs
- ToolStripDesignerUtils.cs
- NamespaceInfo.cs
- FixedDocument.cs
- FixedDocument.cs
- SourceLineInfo.cs
- FormatPage.cs
- TraceLog.cs
- ProviderBase.cs
- InputLanguageProfileNotifySink.cs
- StylusCaptureWithinProperty.cs
- UndoManager.cs
- DynamicExpression.cs
- TraversalRequest.cs
- LineBreak.cs
- NativeMethods.cs
- HttpWebRequest.cs
- XmlAtomErrorReader.cs
- SystemUdpStatistics.cs
- SqlPersonalizationProvider.cs
- SafeNativeMethods.cs
- TextOptions.cs
- DataGridComboBoxColumn.cs
- DataGrid.cs
- CookieHandler.cs
- WebPartCatalogCloseVerb.cs
- AtlasWeb.Designer.cs
- ThousandthOfEmRealPoints.cs
- _TransmitFileOverlappedAsyncResult.cs
- Identity.cs
- Bold.cs
- CustomCategoryAttribute.cs
- RSAPKCS1SignatureFormatter.cs
- SmiXetterAccessMap.cs
- DriveInfo.cs
- AdditionalEntityFunctions.cs
- DataGridViewRowErrorTextNeededEventArgs.cs
- ObjectListCommand.cs
- SyndicationElementExtension.cs
- CodeDomSerializer.cs
- WindowsListBox.cs
- XmlEntity.cs
- XmlIterators.cs
- EmptyStringExpandableObjectConverter.cs