Code:
/ DotNET / DotNET / 8.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
- IdnElement.cs
- MarkupCompiler.cs
- EncryptedData.cs
- ArrayConverter.cs
- SemanticResolver.cs
- UserPreferenceChangedEventArgs.cs
- ZipIOEndOfCentralDirectoryBlock.cs
- UInt16.cs
- validation.cs
- HtmlImageAdapter.cs
- FigureHelper.cs
- StringInfo.cs
- TextReader.cs
- HashMembershipCondition.cs
- QuotedStringWriteStateInfo.cs
- RenderData.cs
- PrinterResolution.cs
- WindowsGraphicsWrapper.cs
- RTLAwareMessageBox.cs
- _Win32.cs
- CodePageUtils.cs
- ComEventsSink.cs
- SynchronizationHandlesCodeDomSerializer.cs
- HtmlGenericControl.cs
- Psha1DerivedKeyGeneratorHelper.cs
- _NativeSSPI.cs
- SelectionItemProviderWrapper.cs
- PixelShader.cs
- ProfileProvider.cs
- MarshalByValueComponent.cs
- XPathSingletonIterator.cs
- DBConcurrencyException.cs
- UnknownWrapper.cs
- SelectionPatternIdentifiers.cs
- ConfigurationErrorsException.cs
- TextBox.cs
- ProcessHostMapPath.cs
- ZoneLinkButton.cs
- StringDictionary.cs
- ContextStack.cs
- RC2CryptoServiceProvider.cs
- TextTreeUndoUnit.cs
- SafePEFileHandle.cs
- HelpInfo.cs
- TextSelectionProcessor.cs
- BrowserInteropHelper.cs
- SweepDirectionValidation.cs
- CollectionEditVerbManager.cs
- AssertSection.cs
- NaturalLanguageHyphenator.cs
- FlowDocumentReader.cs
- FontStretches.cs
- DataTableReader.cs
- EUCJPEncoding.cs
- SerializableAttribute.cs
- ListSurrogate.cs
- _AuthenticationState.cs
- RadioButtonStandardAdapter.cs
- PriorityBinding.cs
- RequestBringIntoViewEventArgs.cs
- DataRecord.cs
- DescendantOverDescendantQuery.cs
- OleDbCommandBuilder.cs
- DBBindings.cs
- FileDialog_Vista_Interop.cs
- GeometryDrawing.cs
- BitmapEffectInput.cs
- FlowLayout.cs
- DbParameterHelper.cs
- SmiEventSink_DeferedProcessing.cs
- CompiledELinqQueryState.cs
- NativeMethods.cs
- VectorCollectionValueSerializer.cs
- NamespaceQuery.cs
- StrokeNodeData.cs
- PlatformCulture.cs
- RuleElement.cs
- WindowsGraphicsWrapper.cs
- Parsers.cs
- SessionIDManager.cs
- PersistenceProviderDirectory.cs
- TextEndOfParagraph.cs
- Lease.cs
- PackagingUtilities.cs
- DbDataRecord.cs
- QueryExecutionOption.cs
- DistributedTransactionPermission.cs
- HtmlInputReset.cs
- HttpApplicationFactory.cs
- FontWeight.cs
- XsdDataContractExporter.cs
- CallContext.cs
- UnmanagedMemoryStreamWrapper.cs
- EntityUtil.cs
- StandardCommands.cs
- XmlReaderSettings.cs
- HttpRequestWrapper.cs
- ViewEvent.cs
- XamlTreeBuilder.cs
- XmlRawWriter.cs