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
- ScriptControlManager.cs
- ActivityTrace.cs
- DisplayMemberTemplateSelector.cs
- XsltArgumentList.cs
- EntityTypeEmitter.cs
- LineSegment.cs
- WasEndpointConfigContainer.cs
- CodeTypeReferenceCollection.cs
- CodeCompileUnit.cs
- CreateRefExpr.cs
- XmlChildEnumerator.cs
- FormViewModeEventArgs.cs
- FieldMetadata.cs
- FixedDocument.cs
- Polyline.cs
- ParserContext.cs
- List.cs
- ChildTable.cs
- TemplateManager.cs
- DataGridViewColumnConverter.cs
- SelectingProviderEventArgs.cs
- ViewGenerator.cs
- XmlProcessingInstruction.cs
- HyperLinkStyle.cs
- ZipIOExtraFieldPaddingElement.cs
- PropVariant.cs
- PointHitTestResult.cs
- XamlToRtfWriter.cs
- XmlDataSourceView.cs
- ListControlDataBindingHandler.cs
- ValidatingPropertiesEventArgs.cs
- WeakReferenceEnumerator.cs
- BuildResult.cs
- UniqueIdentifierService.cs
- ConditionBrowserDialog.cs
- StatusBarPanelClickEvent.cs
- SaveCardRequest.cs
- DefaultTraceListener.cs
- PrintPreviewGraphics.cs
- FileSystemEnumerable.cs
- PopOutPanel.cs
- CodeLinePragma.cs
- HttpCapabilitiesBase.cs
- ListControlDesigner.cs
- ConfigurationElementProperty.cs
- Grant.cs
- Listbox.cs
- PaintValueEventArgs.cs
- Logging.cs
- UdpReplyToBehavior.cs
- BitmapSource.cs
- DeflateStreamAsyncResult.cs
- MessageTransmitTraceRecord.cs
- DefaultBindingPropertyAttribute.cs
- HtmlHead.cs
- BaseUriWithWildcard.cs
- ToolStripAdornerWindowService.cs
- LocalBuilder.cs
- OLEDB_Enum.cs
- XmlDocumentFragment.cs
- ApplicationDirectoryMembershipCondition.cs
- ControlsConfig.cs
- InvokeBinder.cs
- ErrorWebPart.cs
- XPathBuilder.cs
- OperationCanceledException.cs
- XmlDictionaryReader.cs
- ViewGenResults.cs
- ForceCopyBuildProvider.cs
- PageTheme.cs
- StatusBarItemAutomationPeer.cs
- Predicate.cs
- RecognitionResult.cs
- ExecutionScope.cs
- SerialReceived.cs
- CacheAxisQuery.cs
- DataGridItemEventArgs.cs
- AssemblyNameProxy.cs
- CompareValidator.cs
- WebPartHelpVerb.cs
- SmtpLoginAuthenticationModule.cs
- WebPermission.cs
- WorkflowInstanceTerminatedRecord.cs
- SqlClientFactory.cs
- ObfuscationAttribute.cs
- XmlHierarchyData.cs
- RenderTargetBitmap.cs
- ListDataBindEventArgs.cs
- DataGridViewTextBoxColumn.cs
- NotConverter.cs
- SqlReorderer.cs
- PartBasedPackageProperties.cs
- TextEditor.cs
- ProxyElement.cs
- BaseUriHelper.cs
- ValidationError.cs
- XpsResourcePolicy.cs
- NotifyInputEventArgs.cs
- wgx_sdk_version.cs
- LocalClientSecuritySettingsElement.cs