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
- AuthorizationRuleCollection.cs
- CacheAxisQuery.cs
- XmlConvert.cs
- SqlParameterizer.cs
- ComPersistableTypeElement.cs
- ValidationPropertyAttribute.cs
- DataGridViewElement.cs
- TiffBitmapEncoder.cs
- FloatUtil.cs
- DataFieldCollectionEditor.cs
- ChangeToolStripParentVerb.cs
- Thickness.cs
- CodeMethodMap.cs
- ThemeDirectoryCompiler.cs
- ProcessInfo.cs
- ThaiBuddhistCalendar.cs
- ListItemsPage.cs
- TransformerTypeCollection.cs
- StringExpressionSet.cs
- DescendantBaseQuery.cs
- FileSystemWatcher.cs
- FileNotFoundException.cs
- ComponentResourceKeyConverter.cs
- SystemIcmpV4Statistics.cs
- ListControl.cs
- PolyQuadraticBezierSegment.cs
- RightsManagementEncryptionTransform.cs
- DataSpaceManager.cs
- DataGridViewUtilities.cs
- GridLengthConverter.cs
- WindowsImpersonationContext.cs
- DataSourceConverter.cs
- DeadCharTextComposition.cs
- AspNetHostingPermission.cs
- CallbackTimeoutsElement.cs
- ReflectEventDescriptor.cs
- SqlClientWrapperSmiStream.cs
- InstanceKeyCollisionException.cs
- SHA512Managed.cs
- PageVisual.cs
- Compiler.cs
- ListItemConverter.cs
- RuntimeArgumentHandle.cs
- SchemaInfo.cs
- MailWebEventProvider.cs
- CodeCompileUnit.cs
- TaskResultSetter.cs
- EditableTreeList.cs
- XmlSchemaObjectTable.cs
- HttpClientCertificate.cs
- ViewSimplifier.cs
- GifBitmapDecoder.cs
- HwndMouseInputProvider.cs
- WebHostScriptMappingsInstallComponent.cs
- HelloMessage11.cs
- ICollection.cs
- CodeMemberMethod.cs
- ExtensionSimplifierMarkupObject.cs
- DataControlImageButton.cs
- AppDomain.cs
- RequestTimeoutManager.cs
- AuthenticationModuleElement.cs
- TrackPointCollection.cs
- TextBoxBase.cs
- HwndStylusInputProvider.cs
- GridSplitterAutomationPeer.cs
- XmlCharCheckingReader.cs
- QueryParameter.cs
- NamespaceQuery.cs
- SqlLiftIndependentRowExpressions.cs
- TreeNodeStyleCollection.cs
- SolidBrush.cs
- PersistNameAttribute.cs
- DelegatingConfigHost.cs
- UiaCoreApi.cs
- DefaultEventAttribute.cs
- ObjectDataSourceView.cs
- GetParentChain.cs
- BindingEntityInfo.cs
- DbFunctionCommandTree.cs
- SafeSystemMetrics.cs
- CharAnimationUsingKeyFrames.cs
- ServiceHostingEnvironment.cs
- ToolStrip.cs
- FormsAuthenticationModule.cs
- GridViewEditEventArgs.cs
- PermissionSetTriple.cs
- WebBrowserSiteBase.cs
- UnsafeNativeMethods.cs
- SystemUdpStatistics.cs
- CmsUtils.cs
- IndentedTextWriter.cs
- TypePresenter.xaml.cs
- VirtualizingPanel.cs
- SharedStream.cs
- ServiceMetadataExtension.cs
- ComboBoxItem.cs
- SqlConnectionPoolGroupProviderInfo.cs
- WebPageTraceListener.cs
- DesignerSerializationOptionsAttribute.cs