Code:
/ DotNET / DotNET / 8.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
- ZipArchive.cs
- Transform3D.cs
- Typography.cs
- ContextQuery.cs
- PerformanceCounter.cs
- XmlSerializerVersionAttribute.cs
- InputElement.cs
- IntranetCredentialPolicy.cs
- NativeCompoundFileAPIs.cs
- Queue.cs
- ByteStream.cs
- ServiceSecurityAuditBehavior.cs
- TableItemPatternIdentifiers.cs
- Range.cs
- DbConnectionPool.cs
- RSAOAEPKeyExchangeDeformatter.cs
- DataGridViewCellPaintingEventArgs.cs
- Privilege.cs
- CounterCreationDataConverter.cs
- _FixedSizeReader.cs
- DataBindingsDialog.cs
- BitmapVisualManager.cs
- Qualifier.cs
- ProfileModule.cs
- XmlAttributeAttribute.cs
- MatrixTransform3D.cs
- SslStream.cs
- ClassHandlersStore.cs
- SoundPlayer.cs
- DataBoundControlAdapter.cs
- EncoderExceptionFallback.cs
- NameValuePermission.cs
- TreeWalkHelper.cs
- UIAgentMonitor.cs
- StorageRoot.cs
- PerfService.cs
- PropertyFilterAttribute.cs
- ReadOnlyKeyedCollection.cs
- LambdaCompiler.Address.cs
- SingleObjectCollection.cs
- TranslateTransform.cs
- TraversalRequest.cs
- MemoryMappedViewAccessor.cs
- LookupBindingPropertiesAttribute.cs
- CollectionViewGroupInternal.cs
- SchemaInfo.cs
- InputReportEventArgs.cs
- KeyNotFoundException.cs
- XmlNodeChangedEventArgs.cs
- SQLDouble.cs
- ExclusiveTcpTransportManager.cs
- DatePickerTextBox.cs
- TableCell.cs
- CustomValidator.cs
- ComponentRenameEvent.cs
- HttpHandlersSection.cs
- PathFigure.cs
- ParseNumbers.cs
- LinkConverter.cs
- PanningMessageFilter.cs
- XmlSerializerImportOptions.cs
- DataGridViewToolTip.cs
- FormViewInsertedEventArgs.cs
- sortedlist.cs
- FileDialog.cs
- InvariantComparer.cs
- arabicshape.cs
- RtfToken.cs
- ProgressChangedEventArgs.cs
- ForeignKeyConstraint.cs
- WebPartConnectVerb.cs
- ConstraintEnumerator.cs
- HttpModulesSection.cs
- ListBox.cs
- EdmItemError.cs
- PropertyValueUIItem.cs
- HandlerMappingMemo.cs
- TableLayoutStyleCollection.cs
- BackgroundWorker.cs
- TextSyndicationContentKindHelper.cs
- WindowsToolbarItemAsMenuItem.cs
- PageContent.cs
- SelectedDatesCollection.cs
- _NegoState.cs
- DatatypeImplementation.cs
- HttpFileCollectionBase.cs
- DateTimeFormatInfo.cs
- CatalogPartCollection.cs
- ToolStripDesignerAvailabilityAttribute.cs
- PolyLineSegment.cs
- _SSPIWrapper.cs
- SqlNotificationEventArgs.cs
- TextSelectionHelper.cs
- CurrencyWrapper.cs
- AvtEvent.cs
- VectorAnimation.cs
- InputLanguageEventArgs.cs
- ThumbButtonInfo.cs
- regiisutil.cs
- PropertySourceInfo.cs