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
- FixedNode.cs
- CompilerErrorCollection.cs
- ThreadStaticAttribute.cs
- RootContext.cs
- DataGridLinkButton.cs
- EditableLabelControl.cs
- SqlExpressionNullability.cs
- ClientSponsor.cs
- VariableElement.cs
- WebEventTraceProvider.cs
- AttributeQuery.cs
- SR.Designer.cs
- TypefaceMetricsCache.cs
- DecoderFallbackWithFailureFlag.cs
- MarginCollapsingState.cs
- BookmarkNameHelper.cs
- XmlReflectionImporter.cs
- IdentityReference.cs
- DynamicMethod.cs
- WorkflowRuntimeService.cs
- StringFormat.cs
- MenuBindingsEditorForm.cs
- PlainXmlWriter.cs
- UdpContractFilterBehavior.cs
- UnSafeCharBuffer.cs
- SiteMapDesignerDataSourceView.cs
- Registry.cs
- UndoManager.cs
- Quaternion.cs
- BitmapEffectrendercontext.cs
- Aes.cs
- MissingSatelliteAssemblyException.cs
- TreeNodeStyleCollection.cs
- DocumentSequence.cs
- RemoteWebConfigurationHostServer.cs
- UriWriter.cs
- HtmlInputHidden.cs
- TargetControlTypeCache.cs
- ProfileSection.cs
- Size3DValueSerializer.cs
- AuthenticationService.cs
- ClientFormsIdentity.cs
- Rotation3DAnimation.cs
- _SafeNetHandles.cs
- ToolStripComboBox.cs
- PeerName.cs
- MemberAssignment.cs
- ProxyOperationRuntime.cs
- SqlFlattener.cs
- RijndaelManaged.cs
- JsonByteArrayDataContract.cs
- StorageEntityTypeMapping.cs
- SafeCoTaskMem.cs
- StandardOleMarshalObject.cs
- DataGridViewRowHeaderCell.cs
- LookupBindingPropertiesAttribute.cs
- Point3DAnimationUsingKeyFrames.cs
- DocumentGrid.cs
- DetailsViewUpdatedEventArgs.cs
- InkCanvasSelectionAdorner.cs
- DataGridViewLinkColumn.cs
- IsolatedStorageFileStream.cs
- HttpCachePolicy.cs
- TemplateBamlRecordReader.cs
- MultiDataTrigger.cs
- CaseDesigner.xaml.cs
- GridLengthConverter.cs
- CellPartitioner.cs
- BinaryParser.cs
- XmlEventCache.cs
- ConfigXmlCDataSection.cs
- TimeoutValidationAttribute.cs
- Win32Exception.cs
- Command.cs
- ZipIOLocalFileHeader.cs
- UpdateTranslator.cs
- EncryptedType.cs
- UiaCoreTypesApi.cs
- ComponentResourceKey.cs
- PeerCollaborationPermission.cs
- SqlDataRecord.cs
- ChannelSettingsElement.cs
- InputElement.cs
- FrameworkObject.cs
- RequestResizeEvent.cs
- EditorZoneDesigner.cs
- WindowsListView.cs
- GridEntryCollection.cs
- RsaSecurityToken.cs
- ProvidersHelper.cs
- XPathScanner.cs
- ChildrenQuery.cs
- FrameworkEventSource.cs
- SqlStatistics.cs
- TerminateWorkflow.cs
- NullRuntimeConfig.cs
- ElementHost.cs
- _ConnectStream.cs
- Char.cs
- LinqDataView.cs