Code:
/ DotNET / DotNET / 8.0 / untmp / whidbey / REDBITS / ndp / fx / src / Designer / WinForms / System / WinForms / Design / FormatStringEditor.cs / 1 / FormatStringEditor.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope="member", Target="System.Windows.Forms.Design.FormatStringEditor..ctor()")] namespace System.Windows.Forms.Design { using System; using System.ComponentModel; using System.ComponentModel.Design; using System.Diagnostics; using System.Drawing; using System.Drawing.Design; using System.Windows.Forms; ////// /// internal class FormatStringEditor : UITypeEditor { private FormatStringDialog formatStringDialog; ///Provides an editor to edit advanced binding objects. ////// /// public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { if (provider != null) { IWindowsFormsEditorService edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService)); if (edSvc != null) { DataGridViewCellStyle dgvCellStyle = context.Instance as DataGridViewCellStyle; ListControl listControl = context.Instance as ListControl; Debug.Assert(listControl != null || dgvCellStyle != null, "this editor is used for the DataGridViewCellStyle::Format and the ListControl::FormatString properties"); if (formatStringDialog == null) { formatStringDialog = new FormatStringDialog(context); } if (listControl != null) { formatStringDialog.ListControl = listControl; } else { formatStringDialog.DataGridViewCellStyle = dgvCellStyle; } IComponentChangeService changeSvc = (IComponentChangeService)provider.GetService(typeof(IComponentChangeService)); if (changeSvc != null) { if (dgvCellStyle != null) { changeSvc.OnComponentChanging(dgvCellStyle, TypeDescriptor.GetProperties(dgvCellStyle)["Format"]); changeSvc.OnComponentChanging(dgvCellStyle, TypeDescriptor.GetProperties(dgvCellStyle)["NullValue"]); changeSvc.OnComponentChanging(dgvCellStyle, TypeDescriptor.GetProperties(dgvCellStyle)["FormatProvider"]); } else { changeSvc.OnComponentChanging(listControl, TypeDescriptor.GetProperties(listControl)["FormatString"]); changeSvc.OnComponentChanging(listControl, TypeDescriptor.GetProperties(listControl)["FormatInfo"]); } } edSvc.ShowDialog(formatStringDialog); formatStringDialog.End(); if (formatStringDialog.Dirty) { // since the bindings may have changed, the properties listed in the properties window // need to be refreshed TypeDescriptor.Refresh(context.Instance); if (changeSvc != null) { if (dgvCellStyle != null) { changeSvc.OnComponentChanged(dgvCellStyle, TypeDescriptor.GetProperties(dgvCellStyle)["Format"], null, null); changeSvc.OnComponentChanged(dgvCellStyle, TypeDescriptor.GetProperties(dgvCellStyle)["NullValue"], null, null); changeSvc.OnComponentChanged(dgvCellStyle, TypeDescriptor.GetProperties(dgvCellStyle)["FormatProvider"], null, null); } else { changeSvc.OnComponentChanged(listControl, TypeDescriptor.GetProperties(listControl)["FormatString"], null, null); changeSvc.OnComponentChanged(listControl, TypeDescriptor.GetProperties(listControl)["FormatInfo"], null, null); } } } } } return value; } ///Edits the specified value using the specified provider /// within the specified context. ////// /// public override UITypeEditorEditStyle GetEditStyle(ITypeDescriptorContext context) { return UITypeEditorEditStyle.Modal; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.Gets the edit style from the current context. ///
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- TransformerInfoCollection.cs
- TraceLevelStore.cs
- BindingSource.cs
- EventListener.cs
- AtomParser.cs
- BamlResourceContent.cs
- Baml2006ReaderContext.cs
- DrawTreeNodeEventArgs.cs
- XmlQueryContext.cs
- HtmlControl.cs
- OrderedDictionary.cs
- ISCIIEncoding.cs
- DelegateTypeInfo.cs
- MutexSecurity.cs
- XmlSchemaCollection.cs
- ListViewInsertedEventArgs.cs
- Panel.cs
- PermissionSetEnumerator.cs
- CardSpaceShim.cs
- AnimationClockResource.cs
- SQLConvert.cs
- BoundColumn.cs
- TextCompositionManager.cs
- ContainerControl.cs
- WindowsContainer.cs
- ArglessEventHandlerProxy.cs
- SoapUnknownHeader.cs
- ReceiveSecurityHeaderElementManager.cs
- VectorValueSerializer.cs
- EventNotify.cs
- SynchronizationLockException.cs
- PrintDialog.cs
- TypeDependencyAttribute.cs
- ErrorProvider.cs
- SecurityAlgorithmSuiteConverter.cs
- ReadOnlyAttribute.cs
- LineBreakRecord.cs
- WebPartManagerInternals.cs
- BaseCodeDomTreeGenerator.cs
- pingexception.cs
- Win32NamedPipes.cs
- HMAC.cs
- bidPrivateBase.cs
- ObjectViewEntityCollectionData.cs
- BaseTemplateCodeDomTreeGenerator.cs
- NullableIntSumAggregationOperator.cs
- AuthorizationPolicyTypeElementCollection.cs
- AVElementHelper.cs
- UnmanagedMemoryStream.cs
- SingleQueryOperator.cs
- FixedDocumentSequencePaginator.cs
- shaper.cs
- GridViewRowCollection.cs
- VerbConverter.cs
- TransformGroup.cs
- RowToFieldTransformer.cs
- HtmlInputText.cs
- RawStylusInput.cs
- EncryptedType.cs
- WebUtil.cs
- MediaElementAutomationPeer.cs
- FreezableCollection.cs
- GenericEnumConverter.cs
- XmlSchemaGroup.cs
- IdentifierCollection.cs
- DiscoveryDocumentReference.cs
- SectionInformation.cs
- DesignTimeParseData.cs
- SerializerWriterEventHandlers.cs
- ExceptionHelpers.cs
- AuthenticateEventArgs.cs
- Wizard.cs
- CalendarBlackoutDatesCollection.cs
- DataGridTablesFactory.cs
- SmtpFailedRecipientException.cs
- XmlDataSourceView.cs
- ReflectionUtil.cs
- NonClientArea.cs
- SoapInteropTypes.cs
- HWStack.cs
- QilStrConcat.cs
- PlatformCulture.cs
- FileClassifier.cs
- PassportAuthentication.cs
- EncoderBestFitFallback.cs
- ToolStripItemImageRenderEventArgs.cs
- OledbConnectionStringbuilder.cs
- ECDiffieHellman.cs
- SignatureHelper.cs
- ProfilePropertyNameValidator.cs
- TdsParserHelperClasses.cs
- WpfXamlLoader.cs
- PeerPresenceInfo.cs
- JsonStringDataContract.cs
- SystemTcpConnection.cs
- _ConnectStream.cs
- MoveSizeWinEventHandler.cs
- XmlSchemaSimpleContentRestriction.cs
- EntryIndex.cs
- Byte.cs