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
- RedBlackList.cs
- ObjectCacheHost.cs
- TextBox.cs
- CompositeFontFamily.cs
- CapabilitiesAssignment.cs
- WindowsNonControl.cs
- COMException.cs
- TypeExtensionSerializer.cs
- BuilderElements.cs
- UpDownBase.cs
- LayoutSettings.cs
- ColumnWidthChangedEvent.cs
- EntityDesignerUtils.cs
- ListenerAdapterBase.cs
- CompleteWizardStep.cs
- updateconfighost.cs
- ServiceRouteHandler.cs
- Path.cs
- TextRangeAdaptor.cs
- COM2Properties.cs
- SignatureToken.cs
- FixedSOMImage.cs
- OpCopier.cs
- WindowsClaimSet.cs
- NamespaceList.cs
- HttpWebRequest.cs
- KeyValueConfigurationCollection.cs
- ObjectDataSource.cs
- ImpersonationContext.cs
- LongValidator.cs
- basemetadatamappingvisitor.cs
- EventLog.cs
- XmlWrappingWriter.cs
- EncoderNLS.cs
- Run.cs
- XmlSchemaExternal.cs
- MimeMapping.cs
- ErrorFormatterPage.cs
- ArglessEventHandlerProxy.cs
- basemetadatamappingvisitor.cs
- FixedPageProcessor.cs
- ContainerCodeDomSerializer.cs
- ISAPIApplicationHost.cs
- ManageRequest.cs
- Action.cs
- Soap11ServerProtocol.cs
- SignerInfo.cs
- ComponentCollection.cs
- RegularExpressionValidator.cs
- NativeMethods.cs
- SerialReceived.cs
- Addressing.cs
- Message.cs
- MetadataCache.cs
- DocumentPageViewAutomationPeer.cs
- MultiPropertyDescriptorGridEntry.cs
- ActivitySurrogateSelector.cs
- DataSourceHelper.cs
- BindingExpressionBase.cs
- ValidatingReaderNodeData.cs
- TableLayoutStyleCollection.cs
- CurrentTimeZone.cs
- DBConnection.cs
- StateMachineDesignerPaint.cs
- AttachedPropertyDescriptor.cs
- Thickness.cs
- XmlFormatExtensionPointAttribute.cs
- TraceContextEventArgs.cs
- ColorTransformHelper.cs
- DelegatingMessage.cs
- BehaviorEditorPart.cs
- SetStateDesigner.cs
- AQNBuilder.cs
- WindowsTokenRoleProvider.cs
- XmlChoiceIdentifierAttribute.cs
- ObjectFactoryCodeDomTreeGenerator.cs
- ApplicationManager.cs
- EntityCommandExecutionException.cs
- IConvertible.cs
- ActiveXHost.cs
- DesigntimeLicenseContextSerializer.cs
- DiscriminatorMap.cs
- controlskin.cs
- ImageSourceValueSerializer.cs
- PixelFormats.cs
- CapiHashAlgorithm.cs
- LabelEditEvent.cs
- GraphicsContext.cs
- ProcessHostMapPath.cs
- SerializationInfo.cs
- FlagsAttribute.cs
- RowToParametersTransformer.cs
- SqlError.cs
- DbExpressionRules.cs
- ConsoleTraceListener.cs
- TextRangeEdit.cs
- Timer.cs
- EpmContentSerializerBase.cs
- ToolStripItemGlyph.cs
- XmlSchemaAnnotation.cs