Code:
/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / ndp / fx / src / Designer / WinForms / System / WinForms / Design / MaskedTextBoxTextEditor.cs / 1 / MaskedTextBoxTextEditor.cs
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Windows.Forms; using System.Windows.Forms.Design; using System.Drawing.Design; using System.Diagnostics; [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope="member", Target="System.Windows.Forms.Design.MaskedTextBoxTextEditor..ctor()")] namespace System.Windows.Forms.Design { class MaskedTextBoxTextEditor : UITypeEditor { public MaskedTextBoxTextEditor() { } public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { IWindowsFormsEditorService editorSvc = null; if (context != null && context.Instance != null && provider != null) { editorSvc = provider.GetService(typeof(IWindowsFormsEditorService)) as IWindowsFormsEditorService; if (editorSvc != null && context.Instance != null) { MaskedTextBox mtb = context.Instance as MaskedTextBox; // If multiple instances selected, mtb will be null. if( mtb == null ) { mtb = new MaskedTextBox(); mtb.Text = value as string; } MaskedTextBoxTextEditorDropDown dropDown = new MaskedTextBoxTextEditorDropDown(mtb); editorSvc.DropDownControl(dropDown); if (dropDown.Value != null) { value = dropDown.Value; } } } return value; } public override UITypeEditorEditStyle GetEditStyle(ITypeDescriptorContext context) { if (context != null && context.Instance != null) { return UITypeEditorEditStyle.DropDown; } return base.GetEditStyle(context); } public override bool GetPaintValueSupported(ITypeDescriptorContext context) { if (context != null && context.Instance != null) { return false; } return base.GetPaintValueSupported(context); } public override bool IsDropDownResizable { get { return false; } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- OdbcEnvironment.cs
- BitmapEffectState.cs
- DocumentProperties.cs
- ProfileGroupSettings.cs
- ExceptionUtil.cs
- SocketPermission.cs
- DSASignatureFormatter.cs
- mda.cs
- ExpandableObjectConverter.cs
- SqlParameterCollection.cs
- ChildDocumentBlock.cs
- EventRouteFactory.cs
- Thickness.cs
- UIElementHelper.cs
- InvalidCastException.cs
- ApplicationTrust.cs
- SolidBrush.cs
- WebPartDescriptionCollection.cs
- FontSourceCollection.cs
- DesignerView.xaml.cs
- SqlBuilder.cs
- TraceListeners.cs
- XDRSchema.cs
- HttpModuleAction.cs
- ItemList.cs
- LayoutEditorPart.cs
- StorageComplexPropertyMapping.cs
- DeviceSpecific.cs
- StylusPointDescription.cs
- ClientTargetCollection.cs
- Encoder.cs
- PublishLicense.cs
- DomainUpDown.cs
- InputLanguageEventArgs.cs
- XmlAttributeCollection.cs
- HttpResponseWrapper.cs
- SettingsSection.cs
- PropertyAccessVisitor.cs
- EventLogRecord.cs
- PageBuildProvider.cs
- SafeNativeMethods.cs
- BitmapScalingModeValidation.cs
- PathFigureCollectionConverter.cs
- DescendantBaseQuery.cs
- FixedLineResult.cs
- TrustManagerPromptUI.cs
- ImageKeyConverter.cs
- DbXmlEnabledProviderManifest.cs
- ServerTooBusyException.cs
- SplashScreenNativeMethods.cs
- ToolboxItem.cs
- TypeSemantics.cs
- HttpContext.cs
- WebBaseEventKeyComparer.cs
- DetailsViewDeleteEventArgs.cs
- SizeChangedEventArgs.cs
- ImageAttributes.cs
- DefaultMemberAttribute.cs
- RowCache.cs
- ToolStripOverflowButton.cs
- PreviewPrintController.cs
- XmlSchemaImporter.cs
- ConstrainedDataObject.cs
- FrameworkElementFactory.cs
- ArithmeticException.cs
- CodeSubDirectory.cs
- StrokeFIndices.cs
- PageVisual.cs
- ButtonFieldBase.cs
- Base64Stream.cs
- SettingsSavedEventArgs.cs
- InstanceData.cs
- HashSetDebugView.cs
- AbsoluteQuery.cs
- CornerRadius.cs
- StatusBarPanel.cs
- EntityDataSourceReferenceGroup.cs
- ToolStripSettings.cs
- CodeStatement.cs
- DbDataReader.cs
- ProjectionRewriter.cs
- XamlFxTrace.cs
- SafeMemoryMappedViewHandle.cs
- PrintPreviewControl.cs
- KeyValueConfigurationElement.cs
- ParsedRoute.cs
- HttpRequestCacheValidator.cs
- TextElementCollectionHelper.cs
- ReadOnlyDictionary.cs
- StringAnimationBase.cs
- ShaderRenderModeValidation.cs
- TimelineGroup.cs
- BindingGraph.cs
- TypeDescriptionProviderAttribute.cs
- DependencyObjectProvider.cs
- DataSpaceManager.cs
- TransactionManager.cs
- NavigationPropertyEmitter.cs
- StrongNameMembershipCondition.cs
- ControlIdConverter.cs