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
- ArcSegment.cs
- WebBrowserNavigatedEventHandler.cs
- HelpProvider.cs
- Triplet.cs
- XmlChoiceIdentifierAttribute.cs
- MemoryRecordBuffer.cs
- NullableIntMinMaxAggregationOperator.cs
- Identifier.cs
- Track.cs
- XmlCharType.cs
- PathSegmentCollection.cs
- Point3DConverter.cs
- PriorityQueue.cs
- PageAsyncTaskManager.cs
- Empty.cs
- EdmFunctions.cs
- MasterPageParser.cs
- ModelTreeEnumerator.cs
- FrameworkElementFactory.cs
- ExtentJoinTreeNode.cs
- XslException.cs
- AttachedAnnotationChangedEventArgs.cs
- DbgUtil.cs
- TextTreeDeleteContentUndoUnit.cs
- CursorInteropHelper.cs
- Vertex.cs
- MostlySingletonList.cs
- BasicCommandTreeVisitor.cs
- Process.cs
- CompoundFileIOPermission.cs
- ComponentChangingEvent.cs
- AstTree.cs
- QilXmlReader.cs
- GridItemCollection.cs
- MessageQueueException.cs
- KeyManager.cs
- DnsPermission.cs
- WpfKnownType.cs
- PatternMatcher.cs
- WebAdminConfigurationHelper.cs
- FormsIdentity.cs
- Timer.cs
- TextStore.cs
- CompiledELinqQueryState.cs
- XmlIncludeAttribute.cs
- SafeFileMappingHandle.cs
- ResourceManagerWrapper.cs
- EditorZone.cs
- ActivityDefaults.cs
- ProtocolsConfigurationHandler.cs
- ConstraintEnumerator.cs
- NewItemsContextMenuStrip.cs
- BaseParagraph.cs
- Divide.cs
- Style.cs
- EntryPointNotFoundException.cs
- Help.cs
- SystemIPGlobalStatistics.cs
- TextFormatterImp.cs
- SqlMetaData.cs
- ObjectToIdCache.cs
- ColorTransform.cs
- TextFormatterContext.cs
- RoutedCommand.cs
- HMACSHA1.cs
- SortedList.cs
- ConfigXmlWhitespace.cs
- ConstraintStruct.cs
- TokenBasedSet.cs
- RegexWriter.cs
- Point3DConverter.cs
- SerializationStore.cs
- _IPv4Address.cs
- URIFormatException.cs
- HostProtectionException.cs
- RegexCapture.cs
- MsmqHostedTransportManager.cs
- ToolStripScrollButton.cs
- SafeRightsManagementEnvironmentHandle.cs
- DesignerWebPartChrome.cs
- ControlParameter.cs
- ProgressBarBrushConverter.cs
- EntityStoreSchemaGenerator.cs
- GenerateScriptTypeAttribute.cs
- SpeechDetectedEventArgs.cs
- TextProperties.cs
- XComponentModel.cs
- ClosableStream.cs
- ParameterToken.cs
- AttachedAnnotationChangedEventArgs.cs
- MultiTrigger.cs
- RoutedEventValueSerializer.cs
- DerivedKeySecurityToken.cs
- AnimationStorage.cs
- TdsParameterSetter.cs
- ProfileService.cs
- ConstructorNeedsTagAttribute.cs
- WebPartConnectionsCancelEventArgs.cs
- AssemblyInfo.cs
- DynamicResourceExtension.cs