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
- VolatileEnlistmentState.cs
- LabelAutomationPeer.cs
- OdbcCommandBuilder.cs
- GlyphsSerializer.cs
- PersonalizationProviderHelper.cs
- LambdaCompiler.cs
- ProvideValueServiceProvider.cs
- ZoneLinkButton.cs
- Comparer.cs
- ExtenderProvidedPropertyAttribute.cs
- RankException.cs
- COMException.cs
- NaturalLanguageHyphenator.cs
- RuntimeCompatibilityAttribute.cs
- _SpnDictionary.cs
- InfoCardProofToken.cs
- FixedNode.cs
- QueryCacheEntry.cs
- AttributeEmitter.cs
- KeyBinding.cs
- MediaElementAutomationPeer.cs
- XmlDataSource.cs
- XmlTypeMapping.cs
- BindingOperations.cs
- SharedPersonalizationStateInfo.cs
- SimpleBitVector32.cs
- CompositeTypefaceMetrics.cs
- InputLanguage.cs
- MatcherBuilder.cs
- _NativeSSPI.cs
- CriticalFinalizerObject.cs
- Route.cs
- OleDbConnectionFactory.cs
- LookupNode.cs
- ElementsClipboardData.cs
- CodeThrowExceptionStatement.cs
- SystemResourceKey.cs
- BrowserCapabilitiesFactory.cs
- DataProviderNameConverter.cs
- ResolveNameEventArgs.cs
- ColorConverter.cs
- HebrewNumber.cs
- DesignerTransactionCloseEvent.cs
- SafeNativeMethods.cs
- SchemaCollectionCompiler.cs
- HostExecutionContextManager.cs
- DecimalConstantAttribute.cs
- SectionUpdates.cs
- WebControlParameterProxy.cs
- ActiveXHost.cs
- UndirectedGraph.cs
- DataControlFieldsEditor.cs
- Vector3DValueSerializer.cs
- MonthChangedEventArgs.cs
- ImageField.cs
- DataGridViewRowHeightInfoNeededEventArgs.cs
- ArgumentsParser.cs
- CompModHelpers.cs
- PermissionListSet.cs
- ConsoleTraceListener.cs
- XmlSchemaSet.cs
- Crypto.cs
- CreateParams.cs
- ActivityDesigner.cs
- TdsParserSessionPool.cs
- Aggregates.cs
- DocumentPageViewAutomationPeer.cs
- DecimalKeyFrameCollection.cs
- CompilerWrapper.cs
- IndexedEnumerable.cs
- PageCache.cs
- ChannelSinkStacks.cs
- EndpointDiscoveryMetadata11.cs
- StorageFunctionMapping.cs
- ExpressionWriter.cs
- XamlToRtfWriter.cs
- RuleEngine.cs
- PerspectiveCamera.cs
- FontCollection.cs
- CodeMemberField.cs
- HttpResponseInternalWrapper.cs
- Rfc2898DeriveBytes.cs
- Blend.cs
- IFlowDocumentViewer.cs
- DBPropSet.cs
- EdmMember.cs
- ToolStripItemBehavior.cs
- EntitySqlQueryCacheEntry.cs
- RootProfilePropertySettingsCollection.cs
- InlineObject.cs
- ValueTypePropertyReference.cs
- GatewayDefinition.cs
- ListInitExpression.cs
- ProfileParameter.cs
- Control.cs
- FrameworkContentElement.cs
- WebPartCancelEventArgs.cs
- XPathAncestorQuery.cs
- AddInAdapter.cs
- CompiledQuery.cs