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
- OptimalBreakSession.cs
- DispatcherSynchronizationContext.cs
- SoapParser.cs
- ModuleElement.cs
- PinnedBufferMemoryStream.cs
- ConstructorNeedsTagAttribute.cs
- DynamicRendererThreadManager.cs
- ProcessRequestArgs.cs
- DataFormats.cs
- LocalizableResourceBuilder.cs
- Vector3DCollectionConverter.cs
- TCPListener.cs
- IgnoreSection.cs
- UserControl.cs
- Expression.cs
- KeyFrames.cs
- HyperLinkField.cs
- ToolstripProfessionalRenderer.cs
- TextParagraphView.cs
- ToolStripPanelDesigner.cs
- TaskResultSetter.cs
- ContainerParagraph.cs
- DNS.cs
- ArgumentNullException.cs
- RowTypePropertyElement.cs
- Pair.cs
- ProfessionalColorTable.cs
- BlobPersonalizationState.cs
- BrowsableAttribute.cs
- ListViewItemEventArgs.cs
- TextEditorThreadLocalStore.cs
- DateTimeStorage.cs
- Process.cs
- EventsTab.cs
- DocobjHost.cs
- Helper.cs
- DataSourceSelectArguments.cs
- WebPartConnectionsConnectVerb.cs
- CdpEqualityComparer.cs
- XpsPartBase.cs
- CompressionTracing.cs
- DynamicHyperLink.cs
- VBCodeProvider.cs
- ListView.cs
- TagMapInfo.cs
- DataBindingList.cs
- XPathDocument.cs
- CodeSnippetExpression.cs
- ConfigurationSection.cs
- AtlasWeb.Designer.cs
- DataReaderContainer.cs
- RequestUriProcessor.cs
- SqlCommandSet.cs
- WebBrowserContainer.cs
- AutomationPropertyInfo.cs
- XmlCountingReader.cs
- GregorianCalendar.cs
- CallInfo.cs
- HttpResponseInternalWrapper.cs
- StreamingContext.cs
- DataGridViewSortCompareEventArgs.cs
- FontTypeConverter.cs
- TypeForwardedToAttribute.cs
- LoginStatusDesigner.cs
- HtmlContainerControl.cs
- ConnectionPoint.cs
- DataGridViewColumnEventArgs.cs
- PowerModeChangedEventArgs.cs
- ButtonPopupAdapter.cs
- XmlWrappingReader.cs
- EntityTemplateFactory.cs
- XMLUtil.cs
- FreezableOperations.cs
- CustomValidator.cs
- PeerNameRecordCollection.cs
- AppliedDeviceFiltersEditor.cs
- Lazy.cs
- _SafeNetHandles.cs
- ScaleTransform.cs
- LinqDataSourceStatusEventArgs.cs
- ControlCommandSet.cs
- AttachedAnnotationChangedEventArgs.cs
- ConfigurationErrorsException.cs
- DataGridViewRowHeightInfoNeededEventArgs.cs
- HttpListenerResponse.cs
- MetadataSerializer.cs
- XmlAttributeProperties.cs
- ImageListDesigner.cs
- Animatable.cs
- DataListItemEventArgs.cs
- OdbcParameterCollection.cs
- RightsManagementEncryptionTransform.cs
- XhtmlBasicImageAdapter.cs
- EditBehavior.cs
- ThreadInterruptedException.cs
- ToolStripContentPanelRenderEventArgs.cs
- BaseParser.cs
- ZipIOZip64EndOfCentralDirectoryBlock.cs
- TemplateBindingExpression.cs
- _NativeSSPI.cs