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
- CompositeControl.cs
- InvalidateEvent.cs
- AssertSection.cs
- BamlLocalizerErrorNotifyEventArgs.cs
- FormsAuthenticationConfiguration.cs
- OdbcPermission.cs
- TypeLoader.cs
- CodeMemberProperty.cs
- TraceContextRecord.cs
- PermissionRequestEvidence.cs
- XmlSerializerAssemblyAttribute.cs
- CodeCompiler.cs
- SmiContext.cs
- AlignmentYValidation.cs
- BamlLocalizer.cs
- StateDesigner.Layouts.cs
- ModifierKeysConverter.cs
- HTMLTextWriter.cs
- EventLogPermissionAttribute.cs
- ACE.cs
- WpfKnownTypeInvoker.cs
- TextTreeExtractElementUndoUnit.cs
- ExtensionSimplifierMarkupObject.cs
- BitmapEffect.cs
- IsolationInterop.cs
- SimpleBitVector32.cs
- FSWPathEditor.cs
- MultiTrigger.cs
- ImageFormatConverter.cs
- FormCollection.cs
- SrgsElement.cs
- ImageAttributes.cs
- FontNamesConverter.cs
- PageTheme.cs
- Membership.cs
- MultiTouchSystemGestureLogic.cs
- DesignerActionItem.cs
- XmlSchemaSimpleTypeRestriction.cs
- GuidelineCollection.cs
- MediaElementAutomationPeer.cs
- SqlDataSourceCache.cs
- UnsafeNativeMethods.cs
- GraphicsState.cs
- QueryContinueDragEventArgs.cs
- InstanceData.cs
- SpellerHighlightLayer.cs
- BuildProviderUtils.cs
- ProfilePropertyNameValidator.cs
- HttpModuleAction.cs
- PolyLineSegmentFigureLogic.cs
- OracleLob.cs
- ScalarType.cs
- CalloutQueueItem.cs
- FieldToken.cs
- TrustLevel.cs
- StackOverflowException.cs
- BufferedWebEventProvider.cs
- _HeaderInfoTable.cs
- diagnosticsswitches.cs
- InputMethodStateChangeEventArgs.cs
- HitTestDrawingContextWalker.cs
- InheritanceContextHelper.cs
- UpdateCompiler.cs
- ToolBarButton.cs
- ISAPIWorkerRequest.cs
- ThemeDictionaryExtension.cs
- CfgParser.cs
- ResourceDisplayNameAttribute.cs
- BuilderPropertyEntry.cs
- UnregisterInfo.cs
- objectquery_tresulttype.cs
- XhtmlConformanceSection.cs
- ConstructorBuilder.cs
- PrimitiveDataContract.cs
- SmtpException.cs
- XmlElementList.cs
- PropertyGroupDescription.cs
- OperandQuery.cs
- Matrix3D.cs
- HttpListenerContext.cs
- PointHitTestResult.cs
- DataKey.cs
- SHA384Managed.cs
- GeneralTransform.cs
- StringReader.cs
- PointCollection.cs
- Button.cs
- DataConnectionHelper.cs
- FormParameter.cs
- CoTaskMemHandle.cs
- DataGridViewRowsAddedEventArgs.cs
- EventLogTraceListener.cs
- ReferentialConstraint.cs
- CodeEventReferenceExpression.cs
- documentsequencetextcontainer.cs
- TransformedBitmap.cs
- WeakEventTable.cs
- IIS7WorkerRequest.cs
- PrintDialog.cs
- NotifyIcon.cs