Code:
/ FX-1434 / FX-1434 / 1.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
- Monitor.cs
- ProgressBar.cs
- MemberAssignmentAnalysis.cs
- EpmTargetPathSegment.cs
- ModelFunction.cs
- Propagator.JoinPropagator.cs
- ResourceExpressionBuilder.cs
- XmlSchemaComplexType.cs
- AsymmetricAlgorithm.cs
- Parameter.cs
- AnnotationStore.cs
- PeerCollaborationPermission.cs
- ProfileInfo.cs
- TdsParserSafeHandles.cs
- XmlObjectSerializerWriteContext.cs
- GlobalEventManager.cs
- CredentialCache.cs
- SpecularMaterial.cs
- UpdatableWrapper.cs
- PersonalizablePropertyEntry.cs
- HtmlInputButton.cs
- TogglePattern.cs
- GridEntryCollection.cs
- SubstitutionDesigner.cs
- XmlQuerySequence.cs
- DefaultSettingsSection.cs
- StringUtil.cs
- Helper.cs
- BrowserCapabilitiesCodeGenerator.cs
- TextBoxAutoCompleteSourceConverter.cs
- HwndSourceParameters.cs
- WorkflowServiceBehavior.cs
- AuthenticationModuleElement.cs
- DbConnectionOptions.cs
- TitleStyle.cs
- GuidelineCollection.cs
- TypeDescriptor.cs
- UnaryNode.cs
- CopyEncoder.cs
- FigureHelper.cs
- SmtpMail.cs
- SqlBuilder.cs
- WebServiceMethodData.cs
- BaseDataListComponentEditor.cs
- HttpCookie.cs
- MultiSelectRootGridEntry.cs
- MemberDomainMap.cs
- BackgroundWorker.cs
- XmlSchemaSet.cs
- WebPartVerb.cs
- DbReferenceCollection.cs
- MessageQuerySet.cs
- SQLByteStorage.cs
- ConfigurationManager.cs
- XPathNodePointer.cs
- XmlConvert.cs
- GACMembershipCondition.cs
- SessionStateItemCollection.cs
- BamlVersionHeader.cs
- MasterPageParser.cs
- HtmlEmptyTagControlBuilder.cs
- DocumentSchemaValidator.cs
- SuppressedPackageProperties.cs
- DefaultAsyncDataDispatcher.cs
- ColumnMap.cs
- ValuePatternIdentifiers.cs
- AdornerLayer.cs
- StateMachineTimers.cs
- EditorPartChrome.cs
- HandleExceptionArgs.cs
- CaseInsensitiveComparer.cs
- PropertyDescriptor.cs
- AssociationType.cs
- ScrollViewerAutomationPeer.cs
- CollectionsUtil.cs
- ZipIOExtraFieldElement.cs
- TemplateNodeContextMenu.cs
- TdsParser.cs
- DBSqlParserColumn.cs
- EnumMemberAttribute.cs
- SecurityAccessDeniedException.cs
- ActivityWithResultValueSerializer.cs
- ControlFilterExpression.cs
- CompositionTarget.cs
- UriPrefixTable.cs
- ProfilePropertyMetadata.cs
- WebBrowserNavigatedEventHandler.cs
- PersonalizableAttribute.cs
- XpsS0ValidatingLoader.cs
- FactoryId.cs
- DriveInfo.cs
- GlyphTypeface.cs
- CollectionViewGroupRoot.cs
- HttpCookie.cs
- figurelengthconverter.cs
- DataTableTypeConverter.cs
- DataGridViewCheckBoxColumn.cs
- BitmapEffectCollection.cs
- SubstitutionList.cs
- TabPanel.cs