Code:
/ DotNET / DotNET / 8.0 / untmp / whidbey / REDBITS / ndp / fx / src / Designer / WinForms / System / WinForms / Design / MaskedTextBoxDesignerActionList.cs / 1 / MaskedTextBoxDesignerActionList.cs
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
namespace System.Windows.Forms.Design
{
using System;
using System.Design;
using System.Collections;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Windows.Forms;
using System.Diagnostics;
///
/// Describes the list of actions that can be performed in the MaskedTextBox control from the
/// Chrome pannel.
///
internal class MaskedTextBoxDesignerActionList : System.ComponentModel.Design.DesignerActionList
{
MaskedTextBox maskedTextBox;
ITypeDiscoveryService discoverySvc;
IUIService uiSvc;
IHelpService helpService = null;
///
/// Constructor receiving a MaskedTextBox control the action list applies to. The ITypeDiscoveryService
/// service provider is used to populate the canned mask list control in the MaskDesignerDialog dialog and
/// the IUIService provider is used to display the MaskDesignerDialog within VS.
///
public MaskedTextBoxDesignerActionList(MaskedTextBoxDesigner designer) : base(designer.Component)
{
this.maskedTextBox = (MaskedTextBox)designer.Component;
this.discoverySvc = GetService(typeof(ITypeDiscoveryService)) as ITypeDiscoveryService;
this.uiSvc = GetService(typeof(IUIService)) as IUIService;
this.helpService = GetService(typeof(IHelpService)) as IHelpService;
if (discoverySvc == null || uiSvc == null) {
Debug.Fail("could not get either ITypeDiscoveryService or IUIService");
}
}
///
/// Pops up the Mask design dialog for the user to set the control's mask.
///
public void SetMask()
{
string mask = MaskPropertyEditor.EditMask(this.discoverySvc, this.uiSvc, this.maskedTextBox, helpService);
if( mask != null )
{
PropertyDescriptor maskProperty = TypeDescriptor.GetProperties(this.maskedTextBox)["Mask"];
Debug.Assert( maskProperty != null, "Could not find 'Mask' property in control." );
if( maskProperty != null )
{
maskProperty.SetValue(this.maskedTextBox, mask);
}
}
}
///
/// Returns the control's action list items.
///
public override DesignerActionItemCollection GetSortedActionItems()
{
DesignerActionItemCollection items = new DesignerActionItemCollection();
items.Add(new DesignerActionMethodItem(this, "SetMask", SR.GetString(SR.MaskedTextBoxDesignerVerbsSetMaskDesc)));
return items;
}
}
}
// 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
- ListControl.cs
- ImmComposition.cs
- SqlStatistics.cs
- TransactedBatchingBehavior.cs
- ImageDrawing.cs
- _FtpDataStream.cs
- FixedPageAutomationPeer.cs
- GridViewRowCollection.cs
- DataSourceExpressionCollection.cs
- XslVisitor.cs
- Visitor.cs
- VisualStyleInformation.cs
- DataList.cs
- AutoGeneratedField.cs
- Grid.cs
- TextElementEnumerator.cs
- SessionPageStateSection.cs
- ContextProperty.cs
- SyndicationItem.cs
- AtomServiceDocumentSerializer.cs
- X509Extension.cs
- HistoryEventArgs.cs
- Logging.cs
- DataGridViewComboBoxCell.cs
- CopyNamespacesAction.cs
- XmlRootAttribute.cs
- ProfileService.cs
- HitTestWithGeometryDrawingContextWalker.cs
- LineSegment.cs
- Visitor.cs
- ExchangeUtilities.cs
- OdbcConnectionStringbuilder.cs
- sqlcontext.cs
- Compiler.cs
- ServiceProviders.cs
- SurrogateEncoder.cs
- KerberosReceiverSecurityToken.cs
- HandlerWithFactory.cs
- BaseCollection.cs
- NamespaceEmitter.cs
- ObjectItemCollectionAssemblyCacheEntry.cs
- InstanceHandleReference.cs
- AccessDataSource.cs
- CheckBoxBaseAdapter.cs
- DataIdProcessor.cs
- AssociationSetEnd.cs
- DataControlFieldHeaderCell.cs
- ToolStripDropDown.cs
- GenerateScriptTypeAttribute.cs
- WindowsBrush.cs
- DurationConverter.cs
- DataGridViewElement.cs
- XmlCompatibilityReader.cs
- UnaryNode.cs
- ReferenceAssemblyAttribute.cs
- StandardMenuStripVerb.cs
- BulletDecorator.cs
- _CommandStream.cs
- SerializationStore.cs
- DynamicValueConverter.cs
- FileDetails.cs
- DelimitedListTraceListener.cs
- WebPartMovingEventArgs.cs
- ClientType.cs
- InvalidDataException.cs
- MappingItemCollection.cs
- RemoteWebConfigurationHostServer.cs
- AlphaSortedEnumConverter.cs
- SiteMapHierarchicalDataSourceView.cs
- ReflectionPermission.cs
- SinglePageViewer.cs
- ErrorCodes.cs
- FileVersionInfo.cs
- PerformanceCounterLib.cs
- CredentialSelector.cs
- PropertyReference.cs
- SystemPens.cs
- shaperfactoryquerycachekey.cs
- StackOverflowException.cs
- CodeExporter.cs
- CompositionTarget.cs
- IssuanceLicense.cs
- Object.cs
- ScrollChrome.cs
- TypeNameHelper.cs
- XmlLangPropertyAttribute.cs
- LeaseManager.cs
- XmlSchemaSimpleContentRestriction.cs
- HttpCachePolicyWrapper.cs
- documentsequencetextpointer.cs
- CellConstant.cs
- CanonicalizationDriver.cs
- ResponseBodyWriter.cs
- FontDialog.cs
- SqlDataSourceSelectingEventArgs.cs
- TablePatternIdentifiers.cs
- SynchronizedDispatch.cs
- TextDecorationCollection.cs
- TimeSpanMinutesConverter.cs
- ViewBase.cs