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
- SiteMapDataSource.cs
- DataObjectPastingEventArgs.cs
- BinaryMethodMessage.cs
- ResourcesGenerator.cs
- ProfileWorkflowElement.cs
- ArrayHelper.cs
- OperationResponse.cs
- ClaimSet.cs
- AutomationPropertyInfo.cs
- ProcessProtocolHandler.cs
- DesignObjectWrapper.cs
- HttpResponseHeader.cs
- IntranetCredentialPolicy.cs
- WSUtilitySpecificationVersion.cs
- StrongNameMembershipCondition.cs
- GridPatternIdentifiers.cs
- ReferenceEqualityComparer.cs
- ControllableStoryboardAction.cs
- ExpandCollapsePattern.cs
- Point3DAnimationUsingKeyFrames.cs
- Converter.cs
- TypeResolver.cs
- ObjectItemConventionAssemblyLoader.cs
- OleDbCommand.cs
- XmlAttributeOverrides.cs
- ItemCheckedEvent.cs
- XmlDataLoader.cs
- ResXResourceSet.cs
- HtmlElement.cs
- AssemblyBuilderData.cs
- DataGridViewRowErrorTextNeededEventArgs.cs
- SystemFonts.cs
- ActivityValidationServices.cs
- RequestUriProcessor.cs
- BrowserCapabilitiesCodeGenerator.cs
- TypeUnloadedException.cs
- EpmContentDeSerializer.cs
- MarginsConverter.cs
- StringReader.cs
- DisableDpiAwarenessAttribute.cs
- XmlText.cs
- TagElement.cs
- ActiveXContainer.cs
- InputLanguageCollection.cs
- OdbcConnection.cs
- precedingsibling.cs
- ImplicitInputBrush.cs
- AppearanceEditorPart.cs
- JsonFormatGeneratorStatics.cs
- PhysicalAddress.cs
- OverflowException.cs
- ReceiveParametersContent.cs
- ProviderException.cs
- CodeIdentifier.cs
- IndependentAnimationStorage.cs
- AsymmetricKeyExchangeFormatter.cs
- PaintValueEventArgs.cs
- ObjectStateFormatter.cs
- RowVisual.cs
- DecimalConstantAttribute.cs
- PropertyGeneratedEventArgs.cs
- SqlStream.cs
- EUCJPEncoding.cs
- DesignerSelectionListAdapter.cs
- HttpCapabilitiesEvaluator.cs
- MediaContextNotificationWindow.cs
- CommandDevice.cs
- FieldTemplateFactory.cs
- XsdDataContractImporter.cs
- DetailsViewRow.cs
- AttachedPropertyBrowsableAttribute.cs
- CancelEventArgs.cs
- TreeNodeBindingCollection.cs
- DataException.cs
- ConfigXmlAttribute.cs
- LinqDataSourceSelectEventArgs.cs
- ToolStripTemplateNode.cs
- BitmapImage.cs
- ControlParameter.cs
- WebPartEditorOkVerb.cs
- RadioButtonPopupAdapter.cs
- GridViewDeletedEventArgs.cs
- VoiceSynthesis.cs
- NestPullup.cs
- FlowDocument.cs
- SourceItem.cs
- StreamGeometryContext.cs
- PointAnimationClockResource.cs
- QueueProcessor.cs
- ToolboxSnapDragDropEventArgs.cs
- RC2.cs
- ErrorFormatterPage.cs
- WebConvert.cs
- BaseParser.cs
- DataServiceRequestOfT.cs
- TypeSystem.cs
- MethodAccessException.cs
- SerializerProvider.cs
- RIPEMD160.cs
- TransportContext.cs