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
- EntitySetBase.cs
- ExpressionWriter.cs
- DataException.cs
- SaveFileDialog.cs
- ReadOnlyMetadataCollection.cs
- DatagridviewDisplayedBandsData.cs
- ISFClipboardData.cs
- GroupBoxRenderer.cs
- RecipientInfo.cs
- IsolatedStorageFile.cs
- Expander.cs
- GeneralTransformCollection.cs
- UserControlBuildProvider.cs
- EntityDataSourceSelectedEventArgs.cs
- UserControl.cs
- DataSourceView.cs
- GenericXmlSecurityTokenAuthenticator.cs
- XmlObjectSerializerReadContextComplex.cs
- Metafile.cs
- __ComObject.cs
- XPathParser.cs
- ToolStripRenderer.cs
- InterleavedZipPartStream.cs
- EntityModelSchemaGenerator.cs
- ServerIdentity.cs
- _SecureChannel.cs
- MemberAccessException.cs
- FontFamilyIdentifier.cs
- FunctionImportMapping.cs
- SoapUnknownHeader.cs
- ExpressionCopier.cs
- RegistryKey.cs
- PaintValueEventArgs.cs
- AnonymousIdentificationModule.cs
- CompressedStack.cs
- _NegoStream.cs
- ScriptDescriptor.cs
- InstanceNormalEvent.cs
- RuntimeHandles.cs
- ExceptionCollection.cs
- localization.cs
- TextAdaptor.cs
- GeneralTransform.cs
- GeometryCombineModeValidation.cs
- Types.cs
- ObjectDataSourceView.cs
- RegexRunnerFactory.cs
- MenuStrip.cs
- WebPartDisplayMode.cs
- Accessible.cs
- XmlDataDocument.cs
- PrefixQName.cs
- ConnectionInterfaceCollection.cs
- ImageClickEventArgs.cs
- ViewManager.cs
- ChildDocumentBlock.cs
- QueryCursorEventArgs.cs
- TransactionTraceIdentifier.cs
- MatchingStyle.cs
- ContractNamespaceAttribute.cs
- SqlRowUpdatedEvent.cs
- ConnectionConsumerAttribute.cs
- WhitespaceSignificantCollectionAttribute.cs
- UpDownEvent.cs
- DoubleConverter.cs
- HttpEncoder.cs
- Int32Storage.cs
- DiscoveryDocumentSerializer.cs
- CryptoStream.cs
- Byte.cs
- FixUpCollection.cs
- XmlNamespaceDeclarationsAttribute.cs
- ListViewGroup.cs
- Int16Animation.cs
- ExpressionBuilder.cs
- ListView.cs
- SecurityException.cs
- BreakSafeBase.cs
- MailBnfHelper.cs
- PingReply.cs
- UriParserTemplates.cs
- WebDescriptionAttribute.cs
- ArglessEventHandlerProxy.cs
- WebPartEditorApplyVerb.cs
- UnauthorizedWebPart.cs
- TextDocumentView.cs
- ConditionBrowserDialog.cs
- HttpValueCollection.cs
- KnownBoxes.cs
- EncryptedXml.cs
- XPathAxisIterator.cs
- BaseHashHelper.cs
- WebPartConnectionsCloseVerb.cs
- wpf-etw.cs
- BaseCodeDomTreeGenerator.cs
- QueryAccessibilityHelpEvent.cs
- GetWorkflowTree.cs
- Tool.cs
- SelectionChangedEventArgs.cs
- CryptographicAttribute.cs