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
- ListViewInsertedEventArgs.cs
- ByteAnimationUsingKeyFrames.cs
- RegisteredDisposeScript.cs
- ProfilePropertySettings.cs
- WindowsUpDown.cs
- ProcessModule.cs
- HtmlAnchor.cs
- InkPresenter.cs
- VectorCollection.cs
- HandledMouseEvent.cs
- ViewStateModeByIdAttribute.cs
- BitmapEffect.cs
- XmlBinaryReader.cs
- EventItfInfo.cs
- OdbcErrorCollection.cs
- Transform3D.cs
- ApplyHostConfigurationBehavior.cs
- DbgUtil.cs
- StyleSelector.cs
- ColorContext.cs
- UserPreferenceChangingEventArgs.cs
- ListMarkerLine.cs
- IdentitySection.cs
- LayoutDump.cs
- SrgsSubset.cs
- ImageMap.cs
- DynamicQueryableWrapper.cs
- JpegBitmapEncoder.cs
- TreeSet.cs
- CanonicalFormWriter.cs
- HttpGetServerProtocol.cs
- PartialTrustHelpers.cs
- SequenceDesigner.cs
- CommandHelper.cs
- FilterableAttribute.cs
- PrintPreviewControl.cs
- XmlSerializationWriter.cs
- TempFiles.cs
- StringUtil.cs
- ZipFileInfo.cs
- DataGridViewColumnConverter.cs
- DataGridViewComboBoxEditingControl.cs
- UserControlBuildProvider.cs
- ErrorHandlerFaultInfo.cs
- UDPClient.cs
- Soap.cs
- DomainLiteralReader.cs
- VersionValidator.cs
- ColorAnimation.cs
- ListArgumentProvider.cs
- StorageAssociationSetMapping.cs
- EventWaitHandle.cs
- SRDisplayNameAttribute.cs
- MsmqIntegrationElement.cs
- ClipboardProcessor.cs
- XmlRawWriter.cs
- WCFBuildProvider.cs
- _SslState.cs
- DataSourceCache.cs
- ProcessRequestArgs.cs
- UInt64Converter.cs
- Int64.cs
- AnimationException.cs
- PointCollectionValueSerializer.cs
- SecUtil.cs
- CustomAttributeSerializer.cs
- InternalBufferOverflowException.cs
- ListenerElementsCollection.cs
- QilReference.cs
- TabItemAutomationPeer.cs
- NameTable.cs
- CellRelation.cs
- SecurityUtils.cs
- CheckBoxPopupAdapter.cs
- EventProxy.cs
- ToolStripProgressBar.cs
- IsolatedStorageSecurityState.cs
- XmlUtf8RawTextWriter.cs
- MethodCallExpression.cs
- ListViewTableRow.cs
- OutOfMemoryException.cs
- PrtCap_Public_Simple.cs
- DataGridViewRowCollection.cs
- RemotingConfiguration.cs
- ToolStripContentPanelRenderEventArgs.cs
- AppDomainManager.cs
- DataGridViewRowsRemovedEventArgs.cs
- FindProgressChangedEventArgs.cs
- SQLMoney.cs
- XmlAggregates.cs
- OdbcConnectionFactory.cs
- CellCreator.cs
- FactoryId.cs
- GridViewItemAutomationPeer.cs
- ISAPIRuntime.cs
- GlobalAllocSafeHandle.cs
- SourceFileInfo.cs
- Char.cs
- PropertyPath.cs
- ThreadLocal.cs