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
- ControlIdConverter.cs
- CompoundFileStorageReference.cs
- COM2ExtendedBrowsingHandler.cs
- CookieParameter.cs
- ActivationWorker.cs
- ImpersonationContext.cs
- SoundPlayer.cs
- MemoryStream.cs
- FileDialog_Vista_Interop.cs
- SecUtil.cs
- UIElementAutomationPeer.cs
- Repeater.cs
- XsdBuilder.cs
- CLSCompliantAttribute.cs
- ServiceModelConfiguration.cs
- ControlCollection.cs
- HideDisabledControlAdapter.cs
- ComboBoxAutomationPeer.cs
- CheckedListBox.cs
- StorageInfo.cs
- FileUtil.cs
- QilTypeChecker.cs
- IncomingWebRequestContext.cs
- CompilerErrorCollection.cs
- HttpWebRequest.cs
- SmtpAuthenticationManager.cs
- ConnectionString.cs
- OptimizedTemplateContent.cs
- TypeContext.cs
- XhtmlConformanceSection.cs
- ControlValuePropertyAttribute.cs
- CqlParserHelpers.cs
- BindingExpression.cs
- ErrorTolerantObjectWriter.cs
- SizeValueSerializer.cs
- GlyphTypeface.cs
- ArraySubsetEnumerator.cs
- ListSortDescriptionCollection.cs
- TextDecorationCollectionConverter.cs
- StorageEntityContainerMapping.cs
- SapiRecoInterop.cs
- FileDetails.cs
- BulletedList.cs
- TransformProviderWrapper.cs
- PeerTransportCredentialType.cs
- DataViewSettingCollection.cs
- ScopedKnownTypes.cs
- CategoryEditor.cs
- AspNetSynchronizationContext.cs
- PerspectiveCamera.cs
- ClientRuntimeConfig.cs
- AppSettingsReader.cs
- PrePrepareMethodAttribute.cs
- BehaviorService.cs
- LogEntryHeaderDeserializer.cs
- Operand.cs
- ClientBuildManagerCallback.cs
- X509CertificateTrustedIssuerElementCollection.cs
- RegisteredHiddenField.cs
- SqlDeflator.cs
- MetadataStore.cs
- IndexingContentUnit.cs
- Underline.cs
- NativeRightsManagementAPIsStructures.cs
- X500Name.cs
- MissingMethodException.cs
- ClientEventManager.cs
- safex509handles.cs
- WebPartHeaderCloseVerb.cs
- DataGridParentRows.cs
- CacheDict.cs
- FixedHighlight.cs
- AsyncParams.cs
- RandomDelayQueuedSendsAsyncResult.cs
- MatrixStack.cs
- TableItemPattern.cs
- UnmanagedMarshal.cs
- TemplateKeyConverter.cs
- StoryFragments.cs
- latinshape.cs
- GridSplitter.cs
- SplineKeyFrames.cs
- StringBuilder.cs
- WebContext.cs
- DataGridViewCellToolTipTextNeededEventArgs.cs
- CompoundFileStorageReference.cs
- SafePointer.cs
- ManagementPath.cs
- RsaSecurityToken.cs
- XhtmlBasicLabelAdapter.cs
- ExpandCollapseProviderWrapper.cs
- WorkflowRuntimeServiceElementCollection.cs
- UnsafeNativeMethods.cs
- ParseElementCollection.cs
- TimelineClockCollection.cs
- SqlProcedureAttribute.cs
- XmlSchemaGroup.cs
- DecoderReplacementFallback.cs
- UnmanagedMarshal.cs
- ReverseInheritProperty.cs