Code:
/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / 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. // Copyright (c) Microsoft Corporation. All rights reserved.[To be supplied.] ///
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- Single.cs
- WizardStepBase.cs
- DataSvcMapFile.cs
- DataBoundControl.cs
- SafeCertificateContext.cs
- ClockGroup.cs
- HierarchicalDataBoundControl.cs
- RegisteredScript.cs
- StringWriter.cs
- ResourceSetExpression.cs
- Hyperlink.cs
- WindowsMenu.cs
- ArrayMergeHelper.cs
- ContentPlaceHolder.cs
- InputQueue.cs
- FileStream.cs
- CurrencyWrapper.cs
- GridEntry.cs
- BeginEvent.cs
- CellConstant.cs
- BitmapSizeOptions.cs
- TabControlEvent.cs
- HostingEnvironment.cs
- Compiler.cs
- CommandID.cs
- MetadataArtifactLoaderCompositeResource.cs
- XmlAnyAttributeAttribute.cs
- CancellableEnumerable.cs
- CompiledRegexRunner.cs
- RowParagraph.cs
- SettingsAttributes.cs
- TriggerCollection.cs
- LocalIdKeyIdentifierClause.cs
- RuntimeCompatibilityAttribute.cs
- TargetConverter.cs
- SHA384Cng.cs
- HttpModuleCollection.cs
- CreateParams.cs
- ServicePointManagerElement.cs
- XmlEncodedRawTextWriter.cs
- ProfileSettings.cs
- SiteMapNodeItem.cs
- PackageStore.cs
- AuthenticationModulesSection.cs
- SwitchAttribute.cs
- DrawingGroup.cs
- EncoderNLS.cs
- TypeConverter.cs
- ConfigXmlDocument.cs
- RSAOAEPKeyExchangeDeformatter.cs
- QuadraticBezierSegment.cs
- AppSettingsExpressionEditor.cs
- AsymmetricKeyExchangeFormatter.cs
- IPGlobalProperties.cs
- Label.cs
- OutOfMemoryException.cs
- DeclaredTypeValidatorAttribute.cs
- Point3DAnimationUsingKeyFrames.cs
- CodePageUtils.cs
- InteropAutomationProvider.cs
- ValidationHelpers.cs
- DesignBindingPropertyDescriptor.cs
- HtmlHistory.cs
- BezierSegment.cs
- DecoderFallback.cs
- GridViewAutomationPeer.cs
- BitStream.cs
- MarshalByRefObject.cs
- TreeNodeCollection.cs
- DataView.cs
- remotingproxy.cs
- ViewManager.cs
- ResourceType.cs
- ControlValuePropertyAttribute.cs
- PropertyValueUIItem.cs
- AppSecurityManager.cs
- SafeNativeMethods.cs
- HttpContext.cs
- basevalidator.cs
- Listbox.cs
- WebBrowserUriTypeConverter.cs
- FormViewInsertEventArgs.cs
- IODescriptionAttribute.cs
- EmptyArray.cs
- DockPattern.cs
- Parameter.cs
- TrustSection.cs
- HtmlValidatorAdapter.cs
- FormViewPageEventArgs.cs
- ObjectManager.cs
- ListChangedEventArgs.cs
- IndexingContentUnit.cs
- DataGridViewImageCell.cs
- InfiniteTimeSpanConverter.cs
- TargetParameterCountException.cs
- ConfigurationElement.cs
- Menu.cs
- StrongNameIdentityPermission.cs
- ComponentChangedEvent.cs
- SqlTypeSystemProvider.cs