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
- MetadataCache.cs
- DoubleLinkList.cs
- StrokeSerializer.cs
- Message.cs
- log.cs
- DocumentReferenceCollection.cs
- FunctionImportMapping.cs
- ResourceType.cs
- SharedUtils.cs
- DesignTimeParseData.cs
- KeyConverter.cs
- Button.cs
- IisTraceListener.cs
- ReflectTypeDescriptionProvider.cs
- FileVersionInfo.cs
- WebPartUserCapability.cs
- ReferentialConstraint.cs
- DesignerLoader.cs
- RTLAwareMessageBox.cs
- FileDialogPermission.cs
- BinHexEncoding.cs
- OdbcHandle.cs
- TokenBasedSet.cs
- BooleanStorage.cs
- XmlTextEncoder.cs
- WrappedKeySecurityToken.cs
- Point4DValueSerializer.cs
- SqlDependency.cs
- WebBrowserPermission.cs
- CodeActivityMetadata.cs
- DataGridViewCellStyleConverter.cs
- ServicePointManagerElement.cs
- _CommandStream.cs
- BufferedWebEventProvider.cs
- DictionaryEntry.cs
- GraphicsContext.cs
- FileStream.cs
- Message.cs
- XmlAttributeAttribute.cs
- WinEventTracker.cs
- WebPartAddingEventArgs.cs
- LongMinMaxAggregationOperator.cs
- Vector.cs
- SerializerWriterEventHandlers.cs
- CompositeDataBoundControl.cs
- MenuItemStyleCollection.cs
- CryptoApi.cs
- TextRangeBase.cs
- CodeIterationStatement.cs
- EpmTargetPathSegment.cs
- BitmapDecoder.cs
- ObjectDataSourceFilteringEventArgs.cs
- ButtonField.cs
- VSWCFServiceContractGenerator.cs
- WindowsSpinner.cs
- ArrayHelper.cs
- FontStretches.cs
- IPEndPointCollection.cs
- OracleParameterBinding.cs
- IIS7UserPrincipal.cs
- ZipPackagePart.cs
- ContentDisposition.cs
- FormViewRow.cs
- DataServiceHostFactory.cs
- ComponentChangedEvent.cs
- sortedlist.cs
- RootProjectionNode.cs
- XmlSiteMapProvider.cs
- UriExt.cs
- SmiTypedGetterSetter.cs
- GenericTextProperties.cs
- EncodingInfo.cs
- MatrixValueSerializer.cs
- IdentityValidationException.cs
- ServiceDeploymentInfo.cs
- bindurihelper.cs
- EntityDataSourceConfigureObjectContextPanel.cs
- DrawingGroupDrawingContext.cs
- Latin1Encoding.cs
- FieldToken.cs
- WorkflowQueuingService.cs
- EntityDataSourceEntitySetNameItem.cs
- OutputScopeManager.cs
- Rect3D.cs
- LineInfo.cs
- XmlSerializationReader.cs
- COM2ComponentEditor.cs
- unsafenativemethodstextservices.cs
- OleAutBinder.cs
- SpellerHighlightLayer.cs
- SafeCertificateStore.cs
- PermissionAttributes.cs
- XmlSchemaSimpleContentRestriction.cs
- WebProxyScriptElement.cs
- Ipv6Element.cs
- ControlBuilder.cs
- LabelInfo.cs
- TableItemProviderWrapper.cs
- PerformanceCountersElement.cs
- VariableBinder.cs