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
- DataTableReaderListener.cs
- PropertyTab.cs
- FixedLineResult.cs
- XmlReader.cs
- FatalException.cs
- HorizontalAlignConverter.cs
- QilNode.cs
- manifestimages.cs
- OperandQuery.cs
- SymmetricSecurityProtocol.cs
- ScalarRestriction.cs
- FrameworkElementAutomationPeer.cs
- Condition.cs
- MenuItem.cs
- Page.cs
- LinkedList.cs
- Preprocessor.cs
- InternalControlCollection.cs
- Attributes.cs
- OutputWindow.cs
- OdbcErrorCollection.cs
- DbFunctionCommandTree.cs
- RtType.cs
- ListBoxItem.cs
- Transform3D.cs
- StylusOverProperty.cs
- RuntimeConfigLKG.cs
- documentsequencetextpointer.cs
- XamlFilter.cs
- DesignerSerializationVisibilityAttribute.cs
- DataKeyCollection.cs
- ShapingEngine.cs
- CatalogPartChrome.cs
- PassportPrincipal.cs
- Page.cs
- XmlLanguage.cs
- MetadataArtifactLoaderFile.cs
- State.cs
- ConfigurationSettings.cs
- EntityDataSourceValidationException.cs
- HighlightVisual.cs
- SmiEventSink.cs
- IndicCharClassifier.cs
- HeaderedItemsControl.cs
- BevelBitmapEffect.cs
- PreloadedPackages.cs
- HandleCollector.cs
- EffectiveValueEntry.cs
- RegexCapture.cs
- CodeFieldReferenceExpression.cs
- InstancePersistenceCommandException.cs
- FontSource.cs
- GeometryHitTestParameters.cs
- PropertySourceInfo.cs
- DetailsViewDeletedEventArgs.cs
- SuppressIldasmAttribute.cs
- ComboBox.cs
- ClientBuildManager.cs
- DateTimeHelper.cs
- ResourceDictionary.cs
- DomainUpDown.cs
- ApplicationId.cs
- ScrollBar.cs
- TranslateTransform.cs
- EmptyWorkItem.cs
- ForwardPositionQuery.cs
- SuppressIldasmAttribute.cs
- XmlPropertyBag.cs
- StylusPointPropertyUnit.cs
- DataObjectSettingDataEventArgs.cs
- HTMLTagNameToTypeMapper.cs
- AnonymousIdentificationSection.cs
- TwoPhaseCommit.cs
- ExpressionList.cs
- EntityDataSourceSelectedEventArgs.cs
- SafeCryptHandles.cs
- Bits.cs
- FileSystemInfo.cs
- SqlExpressionNullability.cs
- WeakReferenceEnumerator.cs
- DeclarativeCatalogPart.cs
- ModelServiceImpl.cs
- OledbConnectionStringbuilder.cs
- ControlBindingsCollection.cs
- IncrementalReadDecoders.cs
- DynamicRendererThreadManager.cs
- HtmlControl.cs
- DataControlFieldHeaderCell.cs
- ControlParameter.cs
- IncrementalHitTester.cs
- DataGridViewComboBoxEditingControl.cs
- KnownIds.cs
- ContentValidator.cs
- XmlSchemaExternal.cs
- StyleSheetDesigner.cs
- ScrollPatternIdentifiers.cs
- Registration.cs
- DataSourceView.cs
- TraceLevelStore.cs
- DisableDpiAwarenessAttribute.cs