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
- EntitySetDataBindingList.cs
- DataServiceClientException.cs
- xmlsaver.cs
- Point3DAnimation.cs
- AsmxEndpointPickerExtension.cs
- CriticalFinalizerObject.cs
- SocketPermission.cs
- StringDictionary.cs
- TreeSet.cs
- DecimalAnimationUsingKeyFrames.cs
- AssemblyBuilder.cs
- Transactions.cs
- Misc.cs
- SqlMethodAttribute.cs
- StreamAsIStream.cs
- ProviderCollection.cs
- RoutedUICommand.cs
- CodeTypeOfExpression.cs
- Keyboard.cs
- NotCondition.cs
- DataSourceControlBuilder.cs
- EpmTargetPathSegment.cs
- ClrProviderManifest.cs
- FontNamesConverter.cs
- EmissiveMaterial.cs
- TreeViewImageKeyConverter.cs
- DragEvent.cs
- JoinSymbol.cs
- uribuilder.cs
- ExpressionWriter.cs
- MetadataItem.cs
- CreateUserWizardStep.cs
- EntitySqlQueryState.cs
- MdiWindowListItemConverter.cs
- SendMailErrorEventArgs.cs
- FlowStep.cs
- DataGridCellEditEndingEventArgs.cs
- FileClassifier.cs
- RepeatButtonAutomationPeer.cs
- InputLanguageManager.cs
- IdleTimeoutMonitor.cs
- DockProviderWrapper.cs
- XmlEntity.cs
- ProcessStartInfo.cs
- VectorCollectionConverter.cs
- ScrollItemPattern.cs
- _NegoStream.cs
- PipelineModuleStepContainer.cs
- SourceChangedEventArgs.cs
- LeaseManager.cs
- Models.cs
- printdlgexmarshaler.cs
- ButtonBase.cs
- DiscoveryReferences.cs
- NamedServiceModelExtensionCollectionElement.cs
- CanonicalizationDriver.cs
- XmlAttributeHolder.cs
- EditorPartChrome.cs
- SchemaObjectWriter.cs
- SiteMapHierarchicalDataSourceView.cs
- RegisteredDisposeScript.cs
- MSAAEventDispatcher.cs
- BezierSegment.cs
- Geometry.cs
- DateTimeFormatInfo.cs
- controlskin.cs
- CodeVariableDeclarationStatement.cs
- OleDbConnectionPoolGroupProviderInfo.cs
- UiaCoreProviderApi.cs
- SqlParameterCollection.cs
- StringBuilder.cs
- XMLSyntaxException.cs
- DiscoveryMessageSequenceCD1.cs
- DbModificationCommandTree.cs
- ContentPlaceHolder.cs
- Permission.cs
- CompiledRegexRunnerFactory.cs
- ToolStripAdornerWindowService.cs
- AxHost.cs
- ValidationHelper.cs
- SQLBytes.cs
- ProfileProvider.cs
- RuleSettings.cs
- KeyValuePair.cs
- RichTextBoxAutomationPeer.cs
- CompiledRegexRunner.cs
- ServerValidateEventArgs.cs
- GcHandle.cs
- SkinIDTypeConverter.cs
- DataListItemCollection.cs
- ServiceContractViewControl.cs
- NativeCppClassAttribute.cs
- DecimalAnimationUsingKeyFrames.cs
- AutoResizedEvent.cs
- ActionNotSupportedException.cs
- EmissiveMaterial.cs
- WorkflowPageSetupDialog.cs
- SimpleMailWebEventProvider.cs
- CatalogPartCollection.cs
- TableParagraph.cs