From 197c38109da08fbcc4f39e454b2d30f010fd364e Mon Sep 17 00:00:00 2001 From: Mikhail Lipin Date: Wed, 6 Nov 2019 16:39:59 +0300 Subject: [PATCH] Port MaskedTextBoxTextEditor and MaskPropertyEditor Closes #2285 Closes #2286 --- .../src/System.Design.Forwards.cs | 4 +- .../Resources/MaskDesignerDialog.Designer.cs | 831 ++++++++++++++++++ .../src/Resources/MaskDesignerDialog.resx | 484 ++++++++++ .../src/Resources/SR.resx | 65 +- .../Resources/xlf/MaskDesignerDialog.cs.xlf | 42 + .../Resources/xlf/MaskDesignerDialog.de.xlf | 42 + .../Resources/xlf/MaskDesignerDialog.es.xlf | 42 + .../Resources/xlf/MaskDesignerDialog.fr.xlf | 42 + .../Resources/xlf/MaskDesignerDialog.it.xlf | 42 + .../Resources/xlf/MaskDesignerDialog.ja.xlf | 42 + .../Resources/xlf/MaskDesignerDialog.ko.xlf | 42 + .../Resources/xlf/MaskDesignerDialog.pl.xlf | 42 + .../xlf/MaskDesignerDialog.pt-BR.xlf | 42 + .../Resources/xlf/MaskDesignerDialog.ru.xlf | 42 + .../Resources/xlf/MaskDesignerDialog.tr.xlf | 42 + .../xlf/MaskDesignerDialog.zh-Hans.xlf | 42 + .../xlf/MaskDesignerDialog.zh-Hant.xlf | 42 + .../src/Resources/xlf/SR.cs.xlf | 105 +++ .../src/Resources/xlf/SR.de.xlf | 105 +++ .../src/Resources/xlf/SR.es.xlf | 105 +++ .../src/Resources/xlf/SR.fr.xlf | 105 +++ .../src/Resources/xlf/SR.it.xlf | 105 +++ .../src/Resources/xlf/SR.ja.xlf | 105 +++ .../src/Resources/xlf/SR.ko.xlf | 105 +++ .../src/Resources/xlf/SR.pl.xlf | 105 +++ .../src/Resources/xlf/SR.pt-BR.xlf | 105 +++ .../src/Resources/xlf/SR.ru.xlf | 105 +++ .../src/Resources/xlf/SR.tr.xlf | 105 +++ .../src/Resources/xlf/SR.zh-Hans.xlf | 105 +++ .../src/Resources/xlf/SR.zh-Hant.xlf | 105 +++ .../src/System.Windows.Forms.Design.csproj | 13 + .../Windows/Forms/Design/MaskDescriptor.cs | 169 ++++ .../Forms/Design/MaskDescriptorComparer.cs | 91 ++ .../Forms/Design/MaskDescriptorTemplate.cs | 328 +++++++ .../Forms/Design/MaskDesignerDialog.cs | 711 +++++++++++++++ .../Forms/Design/MaskPropertyEditor.cs | 91 ++ .../Forms/Design/MaskedTextBoxDesigner.cs | 300 +++++++ .../Design/MaskedTextBoxDesignerActionList.cs | 66 ++ .../Forms/Design/MaskedTextBoxTextEditor.cs | 64 ++ .../Design/MaskedTextBoxTextEditorDropDown.cs | 94 ++ .../Forms/Design/TextBoxBaseDesigner.cs | 170 ++++ 41 files changed, 5390 insertions(+), 2 deletions(-) create mode 100644 src/System.Windows.Forms.Design/src/Resources/MaskDesignerDialog.Designer.cs create mode 100644 src/System.Windows.Forms.Design/src/Resources/MaskDesignerDialog.resx create mode 100644 src/System.Windows.Forms.Design/src/Resources/xlf/MaskDesignerDialog.cs.xlf create mode 100644 src/System.Windows.Forms.Design/src/Resources/xlf/MaskDesignerDialog.de.xlf create mode 100644 src/System.Windows.Forms.Design/src/Resources/xlf/MaskDesignerDialog.es.xlf create mode 100644 src/System.Windows.Forms.Design/src/Resources/xlf/MaskDesignerDialog.fr.xlf create mode 100644 src/System.Windows.Forms.Design/src/Resources/xlf/MaskDesignerDialog.it.xlf create mode 100644 src/System.Windows.Forms.Design/src/Resources/xlf/MaskDesignerDialog.ja.xlf create mode 100644 src/System.Windows.Forms.Design/src/Resources/xlf/MaskDesignerDialog.ko.xlf create mode 100644 src/System.Windows.Forms.Design/src/Resources/xlf/MaskDesignerDialog.pl.xlf create mode 100644 src/System.Windows.Forms.Design/src/Resources/xlf/MaskDesignerDialog.pt-BR.xlf create mode 100644 src/System.Windows.Forms.Design/src/Resources/xlf/MaskDesignerDialog.ru.xlf create mode 100644 src/System.Windows.Forms.Design/src/Resources/xlf/MaskDesignerDialog.tr.xlf create mode 100644 src/System.Windows.Forms.Design/src/Resources/xlf/MaskDesignerDialog.zh-Hans.xlf create mode 100644 src/System.Windows.Forms.Design/src/Resources/xlf/MaskDesignerDialog.zh-Hant.xlf create mode 100644 src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/MaskDescriptor.cs create mode 100644 src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/MaskDescriptorComparer.cs create mode 100644 src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/MaskDescriptorTemplate.cs create mode 100644 src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/MaskDesignerDialog.cs create mode 100644 src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/MaskPropertyEditor.cs create mode 100644 src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/MaskedTextBoxDesigner.cs create mode 100644 src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/MaskedTextBoxDesignerActionList.cs create mode 100644 src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/MaskedTextBoxTextEditor.cs create mode 100644 src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/MaskedTextBoxTextEditorDropDown.cs create mode 100644 src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/TextBoxBaseDesigner.cs diff --git a/src/System.Design/src/System.Design.Forwards.cs b/src/System.Design/src/System.Design.Forwards.cs index bc6d5dcdd78..8f86fc5a5e2 100644 --- a/src/System.Design/src/System.Design.Forwards.cs +++ b/src/System.Design/src/System.Design.Forwards.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. @@ -18,3 +18,5 @@ [assembly: TypeForwardedTo(typeof(System.Windows.Forms.Design.StringArrayEditor))] [assembly: TypeForwardedTo(typeof(System.Windows.Forms.Design.StringCollectionEditor))] [assembly: TypeForwardedTo(typeof(System.Windows.Forms.Design.TabPageCollectionEditor))] +[assembly: TypeForwardedTo(typeof(System.Windows.Forms.Design.MaskPropertyEditor))] +[assembly: TypeForwardedTo(typeof(System.Windows.Forms.Design.MaskedTextBoxTextEditor))] diff --git a/src/System.Windows.Forms.Design/src/Resources/MaskDesignerDialog.Designer.cs b/src/System.Windows.Forms.Design/src/Resources/MaskDesignerDialog.Designer.cs new file mode 100644 index 00000000000..69a1c55a47c --- /dev/null +++ b/src/System.Windows.Forms.Design/src/Resources/MaskDesignerDialog.Designer.cs @@ -0,0 +1,831 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace System.Windows.Forms.Design.Resources { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class MaskDesignerDialog { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal MaskDesignerDialog() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("System.Windows.Forms.Design.Resources.MaskDesignerDialog", typeof(MaskDesignerDialog).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// + /// Looks up a localized resource of type System.Windows.Forms.AnchorStyles similar to Left, Right. + /// + internal static System.Windows.Forms.AnchorStyles btnCancel_Anchor { + get { + object obj = ResourceManager.GetObject("btnCancel.Anchor", resourceCulture); + return ((System.Windows.Forms.AnchorStyles)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Boolean similar to True. + /// + internal static bool btnCancel_AutoSize { + get { + object obj = ResourceManager.GetObject("btnCancel.AutoSize", resourceCulture); + return ((bool)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Point similar to {X=81,Y=0}. + /// + internal static System.Drawing.Point btnCancel_Location { + get { + object obj = ResourceManager.GetObject("btnCancel.Location", resourceCulture); + return ((System.Drawing.Point)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Size similar to {Width=75, Height=23}. + /// + internal static System.Drawing.Size btnCancel_Size { + get { + object obj = ResourceManager.GetObject("btnCancel.Size", resourceCulture); + return ((System.Drawing.Size)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Int32 similar to 1. + /// + internal static int btnCancel_TabIndex { + get { + object obj = ResourceManager.GetObject("btnCancel.TabIndex", resourceCulture); + return ((int)(obj)); + } + } + + /// + /// Looks up a localized string similar to Cancel. + /// + internal static string btnCancel_Text { + get { + return ResourceManager.GetString("btnCancel.Text", resourceCulture); + } + } + + /// + /// Looks up a localized resource of type System.Windows.Forms.AnchorStyles similar to Left, Right. + /// + internal static System.Windows.Forms.AnchorStyles btnOK_Anchor { + get { + object obj = ResourceManager.GetObject("btnOK.Anchor", resourceCulture); + return ((System.Windows.Forms.AnchorStyles)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Boolean similar to True. + /// + internal static bool btnOK_AutoSize { + get { + object obj = ResourceManager.GetObject("btnOK.AutoSize", resourceCulture); + return ((bool)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Point similar to {X=0,Y=0}. + /// + internal static System.Drawing.Point btnOK_Location { + get { + object obj = ResourceManager.GetObject("btnOK.Location", resourceCulture); + return ((System.Drawing.Point)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Size similar to {Width=75, Height=23}. + /// + internal static System.Drawing.Size btnOK_Size { + get { + object obj = ResourceManager.GetObject("btnOK.Size", resourceCulture); + return ((System.Drawing.Size)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Int32 similar to 0. + /// + internal static int btnOK_TabIndex { + get { + object obj = ResourceManager.GetObject("btnOK.TabIndex", resourceCulture); + return ((int)(obj)); + } + } + + /// + /// Looks up a localized string similar to OK. + /// + internal static string btnOK_Text { + get { + return ResourceManager.GetString("btnOK.Text", resourceCulture); + } + } + + /// + /// Looks up a localized resource of type System.Windows.Forms.AnchorStyles similar to Left. + /// + internal static System.Windows.Forms.AnchorStyles checkBoxUseValidatingType_Anchor { + get { + object obj = ResourceManager.GetObject("checkBoxUseValidatingType.Anchor", resourceCulture); + return ((System.Windows.Forms.AnchorStyles)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Boolean similar to True. + /// + internal static bool checkBoxUseValidatingType_AutoSize { + get { + object obj = ResourceManager.GetObject("checkBoxUseValidatingType.AutoSize", resourceCulture); + return ((bool)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Point similar to {X=364,Y=1}. + /// + internal static System.Drawing.Point checkBoxUseValidatingType_Location { + get { + object obj = ResourceManager.GetObject("checkBoxUseValidatingType.Location", resourceCulture); + return ((System.Drawing.Point)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Size similar to {Width=114, Height=17}. + /// + internal static System.Drawing.Size checkBoxUseValidatingType_Size { + get { + object obj = ResourceManager.GetObject("checkBoxUseValidatingType.Size", resourceCulture); + return ((System.Drawing.Size)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Int32 similar to 2. + /// + internal static int checkBoxUseValidatingType_TabIndex { + get { + object obj = ResourceManager.GetObject("checkBoxUseValidatingType.TabIndex", resourceCulture); + return ((int)(obj)); + } + } + + /// + /// Looks up a localized string similar to &Use ValidatingType. + /// + internal static string checkBoxUseValidatingType_Text { + get { + return ResourceManager.GetString("checkBoxUseValidatingType.Text", resourceCulture); + } + } + + /// + /// Looks up a localized resource of type System.Int32 similar to 160. + /// + internal static int dataFormatHeader_Width { + get { + object obj = ResourceManager.GetObject("dataFormatHeader.Width", resourceCulture); + return ((int)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Windows.Forms.AnchorStyles similar to Left. + /// + internal static System.Windows.Forms.AnchorStyles lblHeader_Anchor { + get { + object obj = ResourceManager.GetObject("lblHeader.Anchor", resourceCulture); + return ((System.Windows.Forms.AnchorStyles)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Boolean similar to True. + /// + internal static bool lblHeader_AutoSize { + get { + object obj = ResourceManager.GetObject("lblHeader.AutoSize", resourceCulture); + return ((bool)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Point similar to {X=0,Y=0}. + /// + internal static System.Drawing.Point lblHeader_Location { + get { + object obj = ResourceManager.GetObject("lblHeader.Location", resourceCulture); + return ((System.Drawing.Point)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Size similar to {Width=469, Height=13}. + /// + internal static System.Drawing.Size lblHeader_Size { + get { + object obj = ResourceManager.GetObject("lblHeader.Size", resourceCulture); + return ((System.Drawing.Size)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Int32 similar to 0. + /// + internal static int lblHeader_TabIndex { + get { + object obj = ResourceManager.GetObject("lblHeader.TabIndex", resourceCulture); + return ((int)(obj)); + } + } + + /// + /// Looks up a localized string similar to &Select a predefined mask description from the list below or select Custom to define a custom mask.. + /// + internal static string lblHeader_Text { + get { + return ResourceManager.GetString("lblHeader.Text", resourceCulture); + } + } + + /// + /// Looks up a localized resource of type System.Windows.Forms.AnchorStyles similar to Left. + /// + internal static System.Windows.Forms.AnchorStyles lblMask_Anchor { + get { + object obj = ResourceManager.GetObject("lblMask.Anchor", resourceCulture); + return ((System.Windows.Forms.AnchorStyles)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Boolean similar to True. + /// + internal static bool lblMask_AutoSize { + get { + object obj = ResourceManager.GetObject("lblMask.AutoSize", resourceCulture); + return ((bool)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Point similar to {X=0,Y=3}. + /// + internal static System.Drawing.Point lblMask_Location { + get { + object obj = ResourceManager.GetObject("lblMask.Location", resourceCulture); + return ((System.Drawing.Point)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Size similar to {Width=35, Height=13}. + /// + internal static System.Drawing.Size lblMask_Size { + get { + object obj = ResourceManager.GetObject("lblMask.Size", resourceCulture); + return ((System.Drawing.Size)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Int32 similar to 0. + /// + internal static int lblMask_TabIndex { + get { + object obj = ResourceManager.GetObject("lblMask.TabIndex", resourceCulture); + return ((int)(obj)); + } + } + + /// + /// Looks up a localized string similar to &Mask:. + /// + internal static string lblMask_Text { + get { + return ResourceManager.GetString("lblMask.Text", resourceCulture); + } + } + + /// + /// Looks up a localized resource of type System.Windows.Forms.AnchorStyles similar to Left. + /// + internal static System.Windows.Forms.AnchorStyles lblTryIt_Anchor { + get { + object obj = ResourceManager.GetObject("lblTryIt.Anchor", resourceCulture); + return ((System.Windows.Forms.AnchorStyles)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Boolean similar to True. + /// + internal static bool lblTryIt_AutoSize { + get { + object obj = ResourceManager.GetObject("lblTryIt.AutoSize", resourceCulture); + return ((bool)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Point similar to {X=0,Y=29}. + /// + internal static System.Drawing.Point lblTryIt_Location { + get { + object obj = ResourceManager.GetObject("lblTryIt.Location", resourceCulture); + return ((System.Drawing.Point)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Size similar to {Width=47, Height=13}. + /// + internal static System.Drawing.Size lblTryIt_Size { + get { + object obj = ResourceManager.GetObject("lblTryIt.Size", resourceCulture); + return ((System.Drawing.Size)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Int32 similar to 3. + /// + internal static int lblTryIt_TabIndex { + get { + object obj = ResourceManager.GetObject("lblTryIt.TabIndex", resourceCulture); + return ((int)(obj)); + } + } + + /// + /// Looks up a localized string similar to &Preview:. + /// + internal static string lblTryIt_Text { + get { + return ResourceManager.GetString("lblTryIt.Text", resourceCulture); + } + } + + /// + /// Looks up a localized resource of type System.Windows.Forms.AnchorStyles similar to Top, Bottom, Left, Right. + /// + internal static System.Windows.Forms.AnchorStyles listViewCannedMasks_Anchor { + get { + object obj = ResourceManager.GetObject("listViewCannedMasks.Anchor", resourceCulture); + return ((System.Windows.Forms.AnchorStyles)(obj)); + } + } + + /// + /// Looks up a localized string similar to . + /// + internal static string listViewCannedMasks_Columns { + get { + return ResourceManager.GetString("listViewCannedMasks.Columns", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to . + /// + internal static string listViewCannedMasks_Columns1 { + get { + return ResourceManager.GetString("listViewCannedMasks.Columns1", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to . + /// + internal static string listViewCannedMasks_Columns2 { + get { + return ResourceManager.GetString("listViewCannedMasks.Columns2", resourceCulture); + } + } + + /// + /// Looks up a localized resource of type System.Boolean similar to False. + /// + internal static bool listViewCannedMasks_LabelWrap { + get { + object obj = ResourceManager.GetObject("listViewCannedMasks.LabelWrap", resourceCulture); + return ((bool)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Point similar to {X=0,Y=19}. + /// + internal static System.Drawing.Point listViewCannedMasks_Location { + get { + object obj = ResourceManager.GetObject("listViewCannedMasks.Location", resourceCulture); + return ((System.Drawing.Point)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Size similar to {Width=478, Height=198}. + /// + internal static System.Drawing.Size listViewCannedMasks_Size { + get { + object obj = ResourceManager.GetObject("listViewCannedMasks.Size", resourceCulture); + return ((System.Drawing.Size)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Int32 similar to 1. + /// + internal static int listViewCannedMasks_TabIndex { + get { + object obj = ResourceManager.GetObject("listViewCannedMasks.TabIndex", resourceCulture); + return ((int)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Int32 similar to 160. + /// + internal static int maskDescriptionHeader_Width { + get { + object obj = ResourceManager.GetObject("maskDescriptionHeader.Width", resourceCulture); + return ((int)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Windows.Forms.AnchorStyles similar to Left, Right. + /// + internal static System.Windows.Forms.AnchorStyles maskedTextBox_Anchor { + get { + object obj = ResourceManager.GetObject("maskedTextBox.Anchor", resourceCulture); + return ((System.Windows.Forms.AnchorStyles)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Point similar to {X=53,Y=26}. + /// + internal static System.Drawing.Point maskedTextBox_Location { + get { + object obj = ResourceManager.GetObject("maskedTextBox.Location", resourceCulture); + return ((System.Drawing.Point)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Size similar to {Width=293, Height=20}. + /// + internal static System.Drawing.Size maskedTextBox_Size { + get { + object obj = ResourceManager.GetObject("maskedTextBox.Size", resourceCulture); + return ((System.Drawing.Size)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Int32 similar to 4. + /// + internal static int maskedTextBox_TabIndex { + get { + object obj = ResourceManager.GetObject("maskedTextBox.TabIndex", resourceCulture); + return ((int)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Windows.Forms.AnchorStyles similar to Left, Right. + /// + internal static System.Windows.Forms.AnchorStyles maskTryItTable_Anchor { + get { + object obj = ResourceManager.GetObject("maskTryItTable.Anchor", resourceCulture); + return ((System.Windows.Forms.AnchorStyles)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Boolean similar to True. + /// + internal static bool maskTryItTable_AutoSize { + get { + object obj = ResourceManager.GetObject("maskTryItTable.AutoSize", resourceCulture); + return ((bool)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Int32 similar to 3. + /// + internal static int maskTryItTable_ColumnCount { + get { + object obj = ResourceManager.GetObject("maskTryItTable.ColumnCount", resourceCulture); + return ((int)(obj)); + } + } + + /// + /// Looks up a localized string similar to <?xml version="1.0" encoding="utf-16"?><TableLayoutSettings><Controls><Control Name="checkBoxUseValidatingType" Row="0" RowSpan="1" Column="2" ColumnSpan="1" /><Control Name="lblMask" Row="0" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="txtBoxMask" Row="0" RowSpan="1" Column="1" ColumnSpan="1" /><Control Name="lblTryIt" Row="1" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="maskedTextBox" Row="1" RowSpan="1" Column="1" ColumnSpan="1" /></Controls><Columns Styles="AutoSize,0,Percent,100,Aut [rest of string was truncated]";. + /// + internal static string maskTryItTable_LayoutSettings { + get { + return ResourceManager.GetString("maskTryItTable.LayoutSettings", resourceCulture); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Point similar to {X=0,Y=223}. + /// + internal static System.Drawing.Point maskTryItTable_Location { + get { + object obj = ResourceManager.GetObject("maskTryItTable.Location", resourceCulture); + return ((System.Drawing.Point)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Int32 similar to 2. + /// + internal static int maskTryItTable_RowCount { + get { + object obj = ResourceManager.GetObject("maskTryItTable.RowCount", resourceCulture); + return ((int)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Size similar to {Width=478, Height=46}. + /// + internal static System.Drawing.Size maskTryItTable_Size { + get { + object obj = ResourceManager.GetObject("maskTryItTable.Size", resourceCulture); + return ((System.Drawing.Size)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Int32 similar to 2. + /// + internal static int maskTryItTable_TabIndex { + get { + object obj = ResourceManager.GetObject("maskTryItTable.TabIndex", resourceCulture); + return ((int)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Windows.Forms.AnchorStyles similar to Right. + /// + internal static System.Windows.Forms.AnchorStyles okCancelTableLayoutPanel_Anchor { + get { + object obj = ResourceManager.GetObject("okCancelTableLayoutPanel.Anchor", resourceCulture); + return ((System.Windows.Forms.AnchorStyles)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Boolean similar to True. + /// + internal static bool okCancelTableLayoutPanel_AutoSize { + get { + object obj = ResourceManager.GetObject("okCancelTableLayoutPanel.AutoSize", resourceCulture); + return ((bool)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Int32 similar to 2. + /// + internal static int okCancelTableLayoutPanel_ColumnCount { + get { + object obj = ResourceManager.GetObject("okCancelTableLayoutPanel.ColumnCount", resourceCulture); + return ((int)(obj)); + } + } + + /// + /// Looks up a localized string similar to <?xml version="1.0" encoding="utf-16"?><TableLayoutSettings><Controls><Control Name="btnCancel" Row="0" RowSpan="1" Column="1" ColumnSpan="1" /><Control Name="btnOK" Row="0" RowSpan="1" Column="0" ColumnSpan="1" /></Controls><Columns Styles="Percent,50,Percent,50" /><Rows Styles="AutoSize,0" /></TableLayoutSettings>. + /// + internal static string okCancelTableLayoutPanel_LayoutSettings { + get { + return ResourceManager.GetString("okCancelTableLayoutPanel.LayoutSettings", resourceCulture); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Point similar to {X=322,Y=278}. + /// + internal static System.Drawing.Point okCancelTableLayoutPanel_Location { + get { + object obj = ResourceManager.GetObject("okCancelTableLayoutPanel.Location", resourceCulture); + return ((System.Drawing.Point)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Int32 similar to 1. + /// + internal static int okCancelTableLayoutPanel_RowCount { + get { + object obj = ResourceManager.GetObject("okCancelTableLayoutPanel.RowCount", resourceCulture); + return ((int)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Size similar to {Width=156, Height=23}. + /// + internal static System.Drawing.Size okCancelTableLayoutPanel_Size { + get { + object obj = ResourceManager.GetObject("okCancelTableLayoutPanel.Size", resourceCulture); + return ((System.Drawing.Size)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Int32 similar to 3. + /// + internal static int okCancelTableLayoutPanel_TabIndex { + get { + object obj = ResourceManager.GetObject("okCancelTableLayoutPanel.TabIndex", resourceCulture); + return ((int)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Windows.Forms.AnchorStyles similar to Top, Bottom, Left, Right. + /// + internal static System.Windows.Forms.AnchorStyles overarchingTableLayoutPanel_Anchor { + get { + object obj = ResourceManager.GetObject("overarchingTableLayoutPanel.Anchor", resourceCulture); + return ((System.Windows.Forms.AnchorStyles)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Int32 similar to 1. + /// + internal static int overarchingTableLayoutPanel_ColumnCount { + get { + object obj = ResourceManager.GetObject("overarchingTableLayoutPanel.ColumnCount", resourceCulture); + return ((int)(obj)); + } + } + + /// + /// Looks up a localized string similar to <?xml version="1.0" encoding="utf-16"?><TableLayoutSettings><Controls><Control Name="maskTryItTable" Row="3" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="okCancelTableLayoutPanel" Row="4" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="lblHeader" Row="1" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="listViewCannedMasks" Row="2" RowSpan="1" Column="0" ColumnSpan="1" /></Controls><Columns Styles="Percent,50" /><Rows Styles="AutoSize,0,AutoSize,0,Percent,50,AutoSize,0,AutoSize,0" /></ [rest of string was truncated]";. + /// + internal static string overarchingTableLayoutPanel_LayoutSettings { + get { + return ResourceManager.GetString("overarchingTableLayoutPanel.LayoutSettings", resourceCulture); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Point similar to {X=13,Y=13}. + /// + internal static System.Drawing.Point overarchingTableLayoutPanel_Location { + get { + object obj = ResourceManager.GetObject("overarchingTableLayoutPanel.Location", resourceCulture); + return ((System.Drawing.Point)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Int32 similar to 5. + /// + internal static int overarchingTableLayoutPanel_RowCount { + get { + object obj = ResourceManager.GetObject("overarchingTableLayoutPanel.RowCount", resourceCulture); + return ((int)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Size similar to {Width=478, Height=301}. + /// + internal static System.Drawing.Size overarchingTableLayoutPanel_Size { + get { + object obj = ResourceManager.GetObject("overarchingTableLayoutPanel.Size", resourceCulture); + return ((System.Drawing.Size)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Int32 similar to 0. + /// + internal static int overarchingTableLayoutPanel_TabIndex { + get { + object obj = ResourceManager.GetObject("overarchingTableLayoutPanel.TabIndex", resourceCulture); + return ((int)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Windows.Forms.AnchorStyles similar to Left, Right. + /// + internal static System.Windows.Forms.AnchorStyles txtBoxMask_Anchor { + get { + object obj = ResourceManager.GetObject("txtBoxMask.Anchor", resourceCulture); + return ((System.Windows.Forms.AnchorStyles)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Point similar to {X=53,Y=0}. + /// + internal static System.Drawing.Point txtBoxMask_Location { + get { + object obj = ResourceManager.GetObject("txtBoxMask.Location", resourceCulture); + return ((System.Drawing.Point)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Size similar to {Width=293, Height=20}. + /// + internal static System.Drawing.Size txtBoxMask_Size { + get { + object obj = ResourceManager.GetObject("txtBoxMask.Size", resourceCulture); + return ((System.Drawing.Size)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Int32 similar to 1. + /// + internal static int txtBoxMask_TabIndex { + get { + object obj = ResourceManager.GetObject("txtBoxMask.TabIndex", resourceCulture); + return ((int)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Int32 similar to 150. + /// + internal static int validatingTypeHeader_Width { + get { + object obj = ResourceManager.GetObject("validatingTypeHeader.Width", resourceCulture); + return ((int)(obj)); + } + } + } +} diff --git a/src/System.Windows.Forms.Design/src/Resources/MaskDesignerDialog.resx b/src/System.Windows.Forms.Design/src/Resources/MaskDesignerDialog.resx new file mode 100644 index 00000000000..55aab695f42 --- /dev/null +++ b/src/System.Windows.Forms.Design/src/Resources/MaskDesignerDialog.resx @@ -0,0 +1,484 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + Left, Right + + + + 53, 26 + + + 293, 20 + + + + 4 + + + maskedTextBox + + + System.Windows.Forms.MaskedTextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + maskTryItTable + + + 4 + + + Left + + + True + + + 0, 0 + + + 469, 13 + + + 0 + + + &Select a predefined mask description from the list below or select Custom to define a custom mask. + + + lblHeader + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + overarchingTableLayoutPanel + + + 2 + + + Top, Bottom, Left, Right + + + + + + 160 + + + + + + 160 + + + + + + 150 + + + False + + + 0, 19 + + + 478, 198 + + + 1 + + + listViewCannedMasks + + + System.Windows.Forms.ListView, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + overarchingTableLayoutPanel + + + 3 + + + Left, Right + + + True + + + 0, 0 + + + 75, 23 + + + 0 + + + OK + + + btnOK + + + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + okCancelTableLayoutPanel + + + 1 + + + Left, Right + + + True + + + 81, 0 + + + 75, 23 + + + 1 + + + Cancel + + + btnCancel + + + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + okCancelTableLayoutPanel + + + 0 + + + Left + + + True + + + 364, 1 + + + 114, 17 + + + 2 + + + &Use ValidatingType + + + checkBoxUseValidatingType + + + System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + maskTryItTable + + + 0 + + + Left, Right + + + True + + + 3 + + + Left + + + True + + + 0, 3 + + + 35, 13 + + + 0 + + + &Mask: + + + lblMask + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + maskTryItTable + + + 1 + + + Left, Right + + + 53, 0 + + + 293, 20 + + + 1 + + + txtBoxMask + + + System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + maskTryItTable + + + 2 + + + Left + + + True + + + 0, 29 + + + 47, 13 + + + 3 + + + &Preview: + + + lblTryIt + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + maskTryItTable + + + 3 + + + 0, 223 + + + 2 + + + 478, 46 + + + 2 + + + maskTryItTable + + + System.Windows.Forms.TableLayoutPanel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + overarchingTableLayoutPanel + + + 0 + + + <?xml version="1.0" encoding="utf-16"?><TableLayoutSettings><Controls><Control Name="checkBoxUseValidatingType" Row="0" RowSpan="1" Column="2" ColumnSpan="1" /><Control Name="lblMask" Row="0" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="txtBoxMask" Row="0" RowSpan="1" Column="1" ColumnSpan="1" /><Control Name="lblTryIt" Row="1" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="maskedTextBox" Row="1" RowSpan="1" Column="1" ColumnSpan="1" /></Controls><Columns Styles="AutoSize,0,Percent,100,AutoSize,0" /><Rows Styles="AutoSize,0,AutoSize,0" /></TableLayoutSettings> + + + Top, Bottom, Left, Right + + + 1 + + + Right + + + True + + + 2 + + + 322, 278 + + + 1 + + + 156, 23 + + + 3 + + + okCancelTableLayoutPanel + + + System.Windows.Forms.TableLayoutPanel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + overarchingTableLayoutPanel + + + 1 + + + <?xml version="1.0" encoding="utf-16"?><TableLayoutSettings><Controls><Control Name="btnCancel" Row="0" RowSpan="1" Column="1" ColumnSpan="1" /><Control Name="btnOK" Row="0" RowSpan="1" Column="0" ColumnSpan="1" /></Controls><Columns Styles="Percent,50,Percent,50" /><Rows Styles="AutoSize,0" /></TableLayoutSettings> + + + 13, 13 + + + 5 + + + 478, 301 + + + 0 + + + overarchingTableLayoutPanel + + + System.Windows.Forms.TableLayoutPanel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 0 + + + <?xml version="1.0" encoding="utf-16"?><TableLayoutSettings><Controls><Control Name="maskTryItTable" Row="3" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="okCancelTableLayoutPanel" Row="4" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="lblHeader" Row="1" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="listViewCannedMasks" Row="2" RowSpan="1" Column="0" ColumnSpan="1" /></Controls><Columns Styles="Percent,50" /><Rows Styles="AutoSize,0,AutoSize,0,Percent,50,AutoSize,0,AutoSize,0" /></TableLayoutSettings> + + + True + + + 6, 13 + + + 503, 326 + + + CenterParent + + + Input Mask + + + maskDescriptionHeader + + + System.Windows.Forms.ColumnHeader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + dataFormatHeader + + + System.Windows.Forms.ColumnHeader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + validatingTypeHeader + + + System.Windows.Forms.ColumnHeader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + errorProvider + + + System.Windows.Forms.ErrorProvider, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + MaskDesignerDialog + + + System.Windows.Forms.Form, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + diff --git a/src/System.Windows.Forms.Design/src/Resources/SR.resx b/src/System.Windows.Forms.Design/src/Resources/SR.resx index ff7b603fc93..67191f023b5 100644 --- a/src/System.Windows.Forms.Design/src/Resources/SR.resx +++ b/src/System.Windows.Forms.Design/src/Resources/SR.resx @@ -768,4 +768,67 @@ Byte Array Property Editor - \ No newline at end of file + + One or more required properties are null or empty. + + + The provided MaskDescriptor is null. + + + Mask is not full. + + + (none) + + + <Custom> + + + Data Format + + + Input Mask + + + Mask Description + + + Validating Type + + + Set Mask... + + + Error at position {0}: {1}. + + + ASCII character expected + + + Alphanumeric character expected + + + Digit expected + + + Signed digit expected + + + Letter expected + + + Prompt character disallowed as input + + + Unavailable edit position + + + Non edit position + + + Position out of range + + + Invalid input character + + diff --git a/src/System.Windows.Forms.Design/src/Resources/xlf/MaskDesignerDialog.cs.xlf b/src/System.Windows.Forms.Design/src/Resources/xlf/MaskDesignerDialog.cs.xlf new file mode 100644 index 00000000000..38d6f465568 --- /dev/null +++ b/src/System.Windows.Forms.Design/src/Resources/xlf/MaskDesignerDialog.cs.xlf @@ -0,0 +1,42 @@ + + + + + + Input Mask + Input Mask + + + + Cancel + Cancel + + + + OK + OK + + + + &Use ValidatingType + &Use ValidatingType + + + + &Select a predefined mask description from the list below or select Custom to define a custom mask. + &Select a predefined mask description from the list below or select Custom to define a custom mask. + + + + &Mask: + &Mask: + + + + &Preview: + &Preview: + + + + + \ No newline at end of file diff --git a/src/System.Windows.Forms.Design/src/Resources/xlf/MaskDesignerDialog.de.xlf b/src/System.Windows.Forms.Design/src/Resources/xlf/MaskDesignerDialog.de.xlf new file mode 100644 index 00000000000..9363344f39f --- /dev/null +++ b/src/System.Windows.Forms.Design/src/Resources/xlf/MaskDesignerDialog.de.xlf @@ -0,0 +1,42 @@ + + + + + + Input Mask + Input Mask + + + + Cancel + Cancel + + + + OK + OK + + + + &Use ValidatingType + &Use ValidatingType + + + + &Select a predefined mask description from the list below or select Custom to define a custom mask. + &Select a predefined mask description from the list below or select Custom to define a custom mask. + + + + &Mask: + &Mask: + + + + &Preview: + &Preview: + + + + + \ No newline at end of file diff --git a/src/System.Windows.Forms.Design/src/Resources/xlf/MaskDesignerDialog.es.xlf b/src/System.Windows.Forms.Design/src/Resources/xlf/MaskDesignerDialog.es.xlf new file mode 100644 index 00000000000..0f7ae9b64eb --- /dev/null +++ b/src/System.Windows.Forms.Design/src/Resources/xlf/MaskDesignerDialog.es.xlf @@ -0,0 +1,42 @@ + + + + + + Input Mask + Input Mask + + + + Cancel + Cancel + + + + OK + OK + + + + &Use ValidatingType + &Use ValidatingType + + + + &Select a predefined mask description from the list below or select Custom to define a custom mask. + &Select a predefined mask description from the list below or select Custom to define a custom mask. + + + + &Mask: + &Mask: + + + + &Preview: + &Preview: + + + + + \ No newline at end of file diff --git a/src/System.Windows.Forms.Design/src/Resources/xlf/MaskDesignerDialog.fr.xlf b/src/System.Windows.Forms.Design/src/Resources/xlf/MaskDesignerDialog.fr.xlf new file mode 100644 index 00000000000..a30ad57a31e --- /dev/null +++ b/src/System.Windows.Forms.Design/src/Resources/xlf/MaskDesignerDialog.fr.xlf @@ -0,0 +1,42 @@ + + + + + + Input Mask + Input Mask + + + + Cancel + Cancel + + + + OK + OK + + + + &Use ValidatingType + &Use ValidatingType + + + + &Select a predefined mask description from the list below or select Custom to define a custom mask. + &Select a predefined mask description from the list below or select Custom to define a custom mask. + + + + &Mask: + &Mask: + + + + &Preview: + &Preview: + + + + + \ No newline at end of file diff --git a/src/System.Windows.Forms.Design/src/Resources/xlf/MaskDesignerDialog.it.xlf b/src/System.Windows.Forms.Design/src/Resources/xlf/MaskDesignerDialog.it.xlf new file mode 100644 index 00000000000..af1b75be886 --- /dev/null +++ b/src/System.Windows.Forms.Design/src/Resources/xlf/MaskDesignerDialog.it.xlf @@ -0,0 +1,42 @@ + + + + + + Input Mask + Input Mask + + + + Cancel + Cancel + + + + OK + OK + + + + &Use ValidatingType + &Use ValidatingType + + + + &Select a predefined mask description from the list below or select Custom to define a custom mask. + &Select a predefined mask description from the list below or select Custom to define a custom mask. + + + + &Mask: + &Mask: + + + + &Preview: + &Preview: + + + + + \ No newline at end of file diff --git a/src/System.Windows.Forms.Design/src/Resources/xlf/MaskDesignerDialog.ja.xlf b/src/System.Windows.Forms.Design/src/Resources/xlf/MaskDesignerDialog.ja.xlf new file mode 100644 index 00000000000..20e3842099d --- /dev/null +++ b/src/System.Windows.Forms.Design/src/Resources/xlf/MaskDesignerDialog.ja.xlf @@ -0,0 +1,42 @@ + + + + + + Input Mask + Input Mask + + + + Cancel + Cancel + + + + OK + OK + + + + &Use ValidatingType + &Use ValidatingType + + + + &Select a predefined mask description from the list below or select Custom to define a custom mask. + &Select a predefined mask description from the list below or select Custom to define a custom mask. + + + + &Mask: + &Mask: + + + + &Preview: + &Preview: + + + + + \ No newline at end of file diff --git a/src/System.Windows.Forms.Design/src/Resources/xlf/MaskDesignerDialog.ko.xlf b/src/System.Windows.Forms.Design/src/Resources/xlf/MaskDesignerDialog.ko.xlf new file mode 100644 index 00000000000..ae9bd75a0b6 --- /dev/null +++ b/src/System.Windows.Forms.Design/src/Resources/xlf/MaskDesignerDialog.ko.xlf @@ -0,0 +1,42 @@ + + + + + + Input Mask + Input Mask + + + + Cancel + Cancel + + + + OK + OK + + + + &Use ValidatingType + &Use ValidatingType + + + + &Select a predefined mask description from the list below or select Custom to define a custom mask. + &Select a predefined mask description from the list below or select Custom to define a custom mask. + + + + &Mask: + &Mask: + + + + &Preview: + &Preview: + + + + + \ No newline at end of file diff --git a/src/System.Windows.Forms.Design/src/Resources/xlf/MaskDesignerDialog.pl.xlf b/src/System.Windows.Forms.Design/src/Resources/xlf/MaskDesignerDialog.pl.xlf new file mode 100644 index 00000000000..3b2aec11c4a --- /dev/null +++ b/src/System.Windows.Forms.Design/src/Resources/xlf/MaskDesignerDialog.pl.xlf @@ -0,0 +1,42 @@ + + + + + + Input Mask + Input Mask + + + + Cancel + Cancel + + + + OK + OK + + + + &Use ValidatingType + &Use ValidatingType + + + + &Select a predefined mask description from the list below or select Custom to define a custom mask. + &Select a predefined mask description from the list below or select Custom to define a custom mask. + + + + &Mask: + &Mask: + + + + &Preview: + &Preview: + + + + + \ No newline at end of file diff --git a/src/System.Windows.Forms.Design/src/Resources/xlf/MaskDesignerDialog.pt-BR.xlf b/src/System.Windows.Forms.Design/src/Resources/xlf/MaskDesignerDialog.pt-BR.xlf new file mode 100644 index 00000000000..cee65567e87 --- /dev/null +++ b/src/System.Windows.Forms.Design/src/Resources/xlf/MaskDesignerDialog.pt-BR.xlf @@ -0,0 +1,42 @@ + + + + + + Input Mask + Input Mask + + + + Cancel + Cancel + + + + OK + OK + + + + &Use ValidatingType + &Use ValidatingType + + + + &Select a predefined mask description from the list below or select Custom to define a custom mask. + &Select a predefined mask description from the list below or select Custom to define a custom mask. + + + + &Mask: + &Mask: + + + + &Preview: + &Preview: + + + + + \ No newline at end of file diff --git a/src/System.Windows.Forms.Design/src/Resources/xlf/MaskDesignerDialog.ru.xlf b/src/System.Windows.Forms.Design/src/Resources/xlf/MaskDesignerDialog.ru.xlf new file mode 100644 index 00000000000..55598841dd5 --- /dev/null +++ b/src/System.Windows.Forms.Design/src/Resources/xlf/MaskDesignerDialog.ru.xlf @@ -0,0 +1,42 @@ + + + + + + Input Mask + Input Mask + + + + Cancel + Cancel + + + + OK + OK + + + + &Use ValidatingType + &Use ValidatingType + + + + &Select a predefined mask description from the list below or select Custom to define a custom mask. + &Select a predefined mask description from the list below or select Custom to define a custom mask. + + + + &Mask: + &Mask: + + + + &Preview: + &Preview: + + + + + \ No newline at end of file diff --git a/src/System.Windows.Forms.Design/src/Resources/xlf/MaskDesignerDialog.tr.xlf b/src/System.Windows.Forms.Design/src/Resources/xlf/MaskDesignerDialog.tr.xlf new file mode 100644 index 00000000000..1f140a1a140 --- /dev/null +++ b/src/System.Windows.Forms.Design/src/Resources/xlf/MaskDesignerDialog.tr.xlf @@ -0,0 +1,42 @@ + + + + + + Input Mask + Input Mask + + + + Cancel + Cancel + + + + OK + OK + + + + &Use ValidatingType + &Use ValidatingType + + + + &Select a predefined mask description from the list below or select Custom to define a custom mask. + &Select a predefined mask description from the list below or select Custom to define a custom mask. + + + + &Mask: + &Mask: + + + + &Preview: + &Preview: + + + + + \ No newline at end of file diff --git a/src/System.Windows.Forms.Design/src/Resources/xlf/MaskDesignerDialog.zh-Hans.xlf b/src/System.Windows.Forms.Design/src/Resources/xlf/MaskDesignerDialog.zh-Hans.xlf new file mode 100644 index 00000000000..af9480f0688 --- /dev/null +++ b/src/System.Windows.Forms.Design/src/Resources/xlf/MaskDesignerDialog.zh-Hans.xlf @@ -0,0 +1,42 @@ + + + + + + Input Mask + Input Mask + + + + Cancel + Cancel + + + + OK + OK + + + + &Use ValidatingType + &Use ValidatingType + + + + &Select a predefined mask description from the list below or select Custom to define a custom mask. + &Select a predefined mask description from the list below or select Custom to define a custom mask. + + + + &Mask: + &Mask: + + + + &Preview: + &Preview: + + + + + \ No newline at end of file diff --git a/src/System.Windows.Forms.Design/src/Resources/xlf/MaskDesignerDialog.zh-Hant.xlf b/src/System.Windows.Forms.Design/src/Resources/xlf/MaskDesignerDialog.zh-Hant.xlf new file mode 100644 index 00000000000..8cda90eb6f3 --- /dev/null +++ b/src/System.Windows.Forms.Design/src/Resources/xlf/MaskDesignerDialog.zh-Hant.xlf @@ -0,0 +1,42 @@ + + + + + + Input Mask + Input Mask + + + + Cancel + Cancel + + + + OK + OK + + + + &Use ValidatingType + &Use ValidatingType + + + + &Select a predefined mask description from the list below or select Custom to define a custom mask. + &Select a predefined mask description from the list below or select Custom to define a custom mask. + + + + &Mask: + &Mask: + + + + &Preview: + &Preview: + + + + + \ No newline at end of file diff --git a/src/System.Windows.Forms.Design/src/Resources/xlf/SR.cs.xlf b/src/System.Windows.Forms.Design/src/Resources/xlf/SR.cs.xlf index 8da3c304732..0e1f1706199 100644 --- a/src/System.Windows.Forms.Design/src/Resources/xlf/SR.cs.xlf +++ b/src/System.Windows.Forms.Design/src/Resources/xlf/SR.cs.xlf @@ -538,6 +538,111 @@ Hodnota {1} není platnou hodnotou pro argument {0}. Hodnota {0} musí být v rozsahu od {2} do {3}. + + Mask is not full. + Mask is not full. + + + + The provided MaskDescriptor is null. + The provided MaskDescriptor is null. + + + + One or more required properties are null or empty. + One or more required properties are null or empty. + + + + (none) + (none) + + + + <Custom> + <Custom> + + + + Data Format + Data Format + + + + Input Mask + Input Mask + + + + Mask Description + Mask Description + + + + Validating Type + Validating Type + + + + Set Mask... + Set Mask... + + + + Alphanumeric character expected + Alphanumeric character expected + + + + ASCII character expected + ASCII character expected + + + + Digit expected + Digit expected + + + + Invalid input character + Invalid input character + + + + Letter expected + Letter expected + + + + Non edit position + Non edit position + + + + Position out of range + Position out of range + + + + Prompt character disallowed as input + Prompt character disallowed as input + + + + Signed digit expected + Signed digit expected + + + + Unavailable edit position + Unavailable edit position + + + + Error at position {0}: {1}. + Error at position {0}: {1}. + + (None) (Žádné) diff --git a/src/System.Windows.Forms.Design/src/Resources/xlf/SR.de.xlf b/src/System.Windows.Forms.Design/src/Resources/xlf/SR.de.xlf index 2416d455fce..d88bbf006dc 100644 --- a/src/System.Windows.Forms.Design/src/Resources/xlf/SR.de.xlf +++ b/src/System.Windows.Forms.Design/src/Resources/xlf/SR.de.xlf @@ -538,6 +538,111 @@ {1} ist kein gültiger Wert für {0}. {0} sollte zwischen {2} und {3} liegen. + + Mask is not full. + Mask is not full. + + + + The provided MaskDescriptor is null. + The provided MaskDescriptor is null. + + + + One or more required properties are null or empty. + One or more required properties are null or empty. + + + + (none) + (none) + + + + <Custom> + <Custom> + + + + Data Format + Data Format + + + + Input Mask + Input Mask + + + + Mask Description + Mask Description + + + + Validating Type + Validating Type + + + + Set Mask... + Set Mask... + + + + Alphanumeric character expected + Alphanumeric character expected + + + + ASCII character expected + ASCII character expected + + + + Digit expected + Digit expected + + + + Invalid input character + Invalid input character + + + + Letter expected + Letter expected + + + + Non edit position + Non edit position + + + + Position out of range + Position out of range + + + + Prompt character disallowed as input + Prompt character disallowed as input + + + + Signed digit expected + Signed digit expected + + + + Unavailable edit position + Unavailable edit position + + + + Error at position {0}: {1}. + Error at position {0}: {1}. + + (None) (Keine) diff --git a/src/System.Windows.Forms.Design/src/Resources/xlf/SR.es.xlf b/src/System.Windows.Forms.Design/src/Resources/xlf/SR.es.xlf index 15f1284670c..2382fa54f57 100644 --- a/src/System.Windows.Forms.Design/src/Resources/xlf/SR.es.xlf +++ b/src/System.Windows.Forms.Design/src/Resources/xlf/SR.es.xlf @@ -538,6 +538,111 @@ '{1}' no es un valor válido para '{0}'. '{0}' debería estar entre {2} y {3}. + + Mask is not full. + Mask is not full. + + + + The provided MaskDescriptor is null. + The provided MaskDescriptor is null. + + + + One or more required properties are null or empty. + One or more required properties are null or empty. + + + + (none) + (none) + + + + <Custom> + <Custom> + + + + Data Format + Data Format + + + + Input Mask + Input Mask + + + + Mask Description + Mask Description + + + + Validating Type + Validating Type + + + + Set Mask... + Set Mask... + + + + Alphanumeric character expected + Alphanumeric character expected + + + + ASCII character expected + ASCII character expected + + + + Digit expected + Digit expected + + + + Invalid input character + Invalid input character + + + + Letter expected + Letter expected + + + + Non edit position + Non edit position + + + + Position out of range + Position out of range + + + + Prompt character disallowed as input + Prompt character disallowed as input + + + + Signed digit expected + Signed digit expected + + + + Unavailable edit position + Unavailable edit position + + + + Error at position {0}: {1}. + Error at position {0}: {1}. + + (None) (Ninguno) diff --git a/src/System.Windows.Forms.Design/src/Resources/xlf/SR.fr.xlf b/src/System.Windows.Forms.Design/src/Resources/xlf/SR.fr.xlf index c05bd3f45cb..c5423ca1b31 100644 --- a/src/System.Windows.Forms.Design/src/Resources/xlf/SR.fr.xlf +++ b/src/System.Windows.Forms.Design/src/Resources/xlf/SR.fr.xlf @@ -538,6 +538,111 @@ '{1}' n'est pas une valeur valide pour '{0}'. '{0}' doit être compris entre {2} et {3}. + + Mask is not full. + Mask is not full. + + + + The provided MaskDescriptor is null. + The provided MaskDescriptor is null. + + + + One or more required properties are null or empty. + One or more required properties are null or empty. + + + + (none) + (none) + + + + <Custom> + <Custom> + + + + Data Format + Data Format + + + + Input Mask + Input Mask + + + + Mask Description + Mask Description + + + + Validating Type + Validating Type + + + + Set Mask... + Set Mask... + + + + Alphanumeric character expected + Alphanumeric character expected + + + + ASCII character expected + ASCII character expected + + + + Digit expected + Digit expected + + + + Invalid input character + Invalid input character + + + + Letter expected + Letter expected + + + + Non edit position + Non edit position + + + + Position out of range + Position out of range + + + + Prompt character disallowed as input + Prompt character disallowed as input + + + + Signed digit expected + Signed digit expected + + + + Unavailable edit position + Unavailable edit position + + + + Error at position {0}: {1}. + Error at position {0}: {1}. + + (None) (Aucun) diff --git a/src/System.Windows.Forms.Design/src/Resources/xlf/SR.it.xlf b/src/System.Windows.Forms.Design/src/Resources/xlf/SR.it.xlf index 1957559e7db..f6989a6ae80 100644 --- a/src/System.Windows.Forms.Design/src/Resources/xlf/SR.it.xlf +++ b/src/System.Windows.Forms.Design/src/Resources/xlf/SR.it.xlf @@ -538,6 +538,111 @@ '{1}' non è un valore valido per '{0}'. '{0}' deve essere compreso tra {2} e {3}. + + Mask is not full. + Mask is not full. + + + + The provided MaskDescriptor is null. + The provided MaskDescriptor is null. + + + + One or more required properties are null or empty. + One or more required properties are null or empty. + + + + (none) + (none) + + + + <Custom> + <Custom> + + + + Data Format + Data Format + + + + Input Mask + Input Mask + + + + Mask Description + Mask Description + + + + Validating Type + Validating Type + + + + Set Mask... + Set Mask... + + + + Alphanumeric character expected + Alphanumeric character expected + + + + ASCII character expected + ASCII character expected + + + + Digit expected + Digit expected + + + + Invalid input character + Invalid input character + + + + Letter expected + Letter expected + + + + Non edit position + Non edit position + + + + Position out of range + Position out of range + + + + Prompt character disallowed as input + Prompt character disallowed as input + + + + Signed digit expected + Signed digit expected + + + + Unavailable edit position + Unavailable edit position + + + + Error at position {0}: {1}. + Error at position {0}: {1}. + + (None) (Nessuno) diff --git a/src/System.Windows.Forms.Design/src/Resources/xlf/SR.ja.xlf b/src/System.Windows.Forms.Design/src/Resources/xlf/SR.ja.xlf index d3edea42914..69a06976543 100644 --- a/src/System.Windows.Forms.Design/src/Resources/xlf/SR.ja.xlf +++ b/src/System.Windows.Forms.Design/src/Resources/xlf/SR.ja.xlf @@ -538,6 +538,111 @@ '{1}' は '{0}' に有効な値ではありません。'{0}' は {2} と {3} の間でなければなりません。 + + Mask is not full. + Mask is not full. + + + + The provided MaskDescriptor is null. + The provided MaskDescriptor is null. + + + + One or more required properties are null or empty. + One or more required properties are null or empty. + + + + (none) + (none) + + + + <Custom> + <Custom> + + + + Data Format + Data Format + + + + Input Mask + Input Mask + + + + Mask Description + Mask Description + + + + Validating Type + Validating Type + + + + Set Mask... + Set Mask... + + + + Alphanumeric character expected + Alphanumeric character expected + + + + ASCII character expected + ASCII character expected + + + + Digit expected + Digit expected + + + + Invalid input character + Invalid input character + + + + Letter expected + Letter expected + + + + Non edit position + Non edit position + + + + Position out of range + Position out of range + + + + Prompt character disallowed as input + Prompt character disallowed as input + + + + Signed digit expected + Signed digit expected + + + + Unavailable edit position + Unavailable edit position + + + + Error at position {0}: {1}. + Error at position {0}: {1}. + + (None) (なし) diff --git a/src/System.Windows.Forms.Design/src/Resources/xlf/SR.ko.xlf b/src/System.Windows.Forms.Design/src/Resources/xlf/SR.ko.xlf index ab5114348c2..9a7ecd94dfb 100644 --- a/src/System.Windows.Forms.Design/src/Resources/xlf/SR.ko.xlf +++ b/src/System.Windows.Forms.Design/src/Resources/xlf/SR.ko.xlf @@ -538,6 +538,111 @@ '{1}'은(는) '{0}'에 사용할 수 없는 값입니다. '{0}'은(는) {2}에서 {3} 사이에 있어야 합니다. + + Mask is not full. + Mask is not full. + + + + The provided MaskDescriptor is null. + The provided MaskDescriptor is null. + + + + One or more required properties are null or empty. + One or more required properties are null or empty. + + + + (none) + (none) + + + + <Custom> + <Custom> + + + + Data Format + Data Format + + + + Input Mask + Input Mask + + + + Mask Description + Mask Description + + + + Validating Type + Validating Type + + + + Set Mask... + Set Mask... + + + + Alphanumeric character expected + Alphanumeric character expected + + + + ASCII character expected + ASCII character expected + + + + Digit expected + Digit expected + + + + Invalid input character + Invalid input character + + + + Letter expected + Letter expected + + + + Non edit position + Non edit position + + + + Position out of range + Position out of range + + + + Prompt character disallowed as input + Prompt character disallowed as input + + + + Signed digit expected + Signed digit expected + + + + Unavailable edit position + Unavailable edit position + + + + Error at position {0}: {1}. + Error at position {0}: {1}. + + (None) (없음) diff --git a/src/System.Windows.Forms.Design/src/Resources/xlf/SR.pl.xlf b/src/System.Windows.Forms.Design/src/Resources/xlf/SR.pl.xlf index 2a616876053..304a3427221 100644 --- a/src/System.Windows.Forms.Design/src/Resources/xlf/SR.pl.xlf +++ b/src/System.Windows.Forms.Design/src/Resources/xlf/SR.pl.xlf @@ -538,6 +538,111 @@ '{1}' nie jest prawidłową wartością dla '{0}'. Wartość '{0}' powinna należeć do zakresu od {2} do {3}. + + Mask is not full. + Mask is not full. + + + + The provided MaskDescriptor is null. + The provided MaskDescriptor is null. + + + + One or more required properties are null or empty. + One or more required properties are null or empty. + + + + (none) + (none) + + + + <Custom> + <Custom> + + + + Data Format + Data Format + + + + Input Mask + Input Mask + + + + Mask Description + Mask Description + + + + Validating Type + Validating Type + + + + Set Mask... + Set Mask... + + + + Alphanumeric character expected + Alphanumeric character expected + + + + ASCII character expected + ASCII character expected + + + + Digit expected + Digit expected + + + + Invalid input character + Invalid input character + + + + Letter expected + Letter expected + + + + Non edit position + Non edit position + + + + Position out of range + Position out of range + + + + Prompt character disallowed as input + Prompt character disallowed as input + + + + Signed digit expected + Signed digit expected + + + + Unavailable edit position + Unavailable edit position + + + + Error at position {0}: {1}. + Error at position {0}: {1}. + + (None) (Brak) diff --git a/src/System.Windows.Forms.Design/src/Resources/xlf/SR.pt-BR.xlf b/src/System.Windows.Forms.Design/src/Resources/xlf/SR.pt-BR.xlf index 215bdd54917..6bf941d7519 100644 --- a/src/System.Windows.Forms.Design/src/Resources/xlf/SR.pt-BR.xlf +++ b/src/System.Windows.Forms.Design/src/Resources/xlf/SR.pt-BR.xlf @@ -538,6 +538,111 @@ '{1}' não é um valor válido para '{0}'. '{0}' deve estar entre {2} e {3}. + + Mask is not full. + Mask is not full. + + + + The provided MaskDescriptor is null. + The provided MaskDescriptor is null. + + + + One or more required properties are null or empty. + One or more required properties are null or empty. + + + + (none) + (none) + + + + <Custom> + <Custom> + + + + Data Format + Data Format + + + + Input Mask + Input Mask + + + + Mask Description + Mask Description + + + + Validating Type + Validating Type + + + + Set Mask... + Set Mask... + + + + Alphanumeric character expected + Alphanumeric character expected + + + + ASCII character expected + ASCII character expected + + + + Digit expected + Digit expected + + + + Invalid input character + Invalid input character + + + + Letter expected + Letter expected + + + + Non edit position + Non edit position + + + + Position out of range + Position out of range + + + + Prompt character disallowed as input + Prompt character disallowed as input + + + + Signed digit expected + Signed digit expected + + + + Unavailable edit position + Unavailable edit position + + + + Error at position {0}: {1}. + Error at position {0}: {1}. + + (None) (Nenhum) diff --git a/src/System.Windows.Forms.Design/src/Resources/xlf/SR.ru.xlf b/src/System.Windows.Forms.Design/src/Resources/xlf/SR.ru.xlf index 2e2badfb4cf..2dce34b24e0 100644 --- a/src/System.Windows.Forms.Design/src/Resources/xlf/SR.ru.xlf +++ b/src/System.Windows.Forms.Design/src/Resources/xlf/SR.ru.xlf @@ -538,6 +538,111 @@ '{1}' не является допустимым значением для '{0}'. Значение '{0}' должно лежать в диапазоне от {2} до {3}. + + Mask is not full. + Mask is not full. + + + + The provided MaskDescriptor is null. + The provided MaskDescriptor is null. + + + + One or more required properties are null or empty. + One or more required properties are null or empty. + + + + (none) + (none) + + + + <Custom> + <Custom> + + + + Data Format + Data Format + + + + Input Mask + Input Mask + + + + Mask Description + Mask Description + + + + Validating Type + Validating Type + + + + Set Mask... + Set Mask... + + + + Alphanumeric character expected + Alphanumeric character expected + + + + ASCII character expected + ASCII character expected + + + + Digit expected + Digit expected + + + + Invalid input character + Invalid input character + + + + Letter expected + Letter expected + + + + Non edit position + Non edit position + + + + Position out of range + Position out of range + + + + Prompt character disallowed as input + Prompt character disallowed as input + + + + Signed digit expected + Signed digit expected + + + + Unavailable edit position + Unavailable edit position + + + + Error at position {0}: {1}. + Error at position {0}: {1}. + + (None) (Нет) diff --git a/src/System.Windows.Forms.Design/src/Resources/xlf/SR.tr.xlf b/src/System.Windows.Forms.Design/src/Resources/xlf/SR.tr.xlf index 125ec5cd2b5..88d16ab356b 100644 --- a/src/System.Windows.Forms.Design/src/Resources/xlf/SR.tr.xlf +++ b/src/System.Windows.Forms.Design/src/Resources/xlf/SR.tr.xlf @@ -538,6 +538,111 @@ '{1}' değeri '{0}' öğesi için geçerli değil. '{0}' değeri {2} ile {3} arasında olmalıdır. + + Mask is not full. + Mask is not full. + + + + The provided MaskDescriptor is null. + The provided MaskDescriptor is null. + + + + One or more required properties are null or empty. + One or more required properties are null or empty. + + + + (none) + (none) + + + + <Custom> + <Custom> + + + + Data Format + Data Format + + + + Input Mask + Input Mask + + + + Mask Description + Mask Description + + + + Validating Type + Validating Type + + + + Set Mask... + Set Mask... + + + + Alphanumeric character expected + Alphanumeric character expected + + + + ASCII character expected + ASCII character expected + + + + Digit expected + Digit expected + + + + Invalid input character + Invalid input character + + + + Letter expected + Letter expected + + + + Non edit position + Non edit position + + + + Position out of range + Position out of range + + + + Prompt character disallowed as input + Prompt character disallowed as input + + + + Signed digit expected + Signed digit expected + + + + Unavailable edit position + Unavailable edit position + + + + Error at position {0}: {1}. + Error at position {0}: {1}. + + (None) (Yok) diff --git a/src/System.Windows.Forms.Design/src/Resources/xlf/SR.zh-Hans.xlf b/src/System.Windows.Forms.Design/src/Resources/xlf/SR.zh-Hans.xlf index 43556a2d9e9..560bae2f2cb 100644 --- a/src/System.Windows.Forms.Design/src/Resources/xlf/SR.zh-Hans.xlf +++ b/src/System.Windows.Forms.Design/src/Resources/xlf/SR.zh-Hans.xlf @@ -538,6 +538,111 @@ “{1}”不是“{0}”的有效值。“{0}”应介于 {2} 和 {3} 之间。 + + Mask is not full. + Mask is not full. + + + + The provided MaskDescriptor is null. + The provided MaskDescriptor is null. + + + + One or more required properties are null or empty. + One or more required properties are null or empty. + + + + (none) + (none) + + + + <Custom> + <Custom> + + + + Data Format + Data Format + + + + Input Mask + Input Mask + + + + Mask Description + Mask Description + + + + Validating Type + Validating Type + + + + Set Mask... + Set Mask... + + + + Alphanumeric character expected + Alphanumeric character expected + + + + ASCII character expected + ASCII character expected + + + + Digit expected + Digit expected + + + + Invalid input character + Invalid input character + + + + Letter expected + Letter expected + + + + Non edit position + Non edit position + + + + Position out of range + Position out of range + + + + Prompt character disallowed as input + Prompt character disallowed as input + + + + Signed digit expected + Signed digit expected + + + + Unavailable edit position + Unavailable edit position + + + + Error at position {0}: {1}. + Error at position {0}: {1}. + + (None) (无) diff --git a/src/System.Windows.Forms.Design/src/Resources/xlf/SR.zh-Hant.xlf b/src/System.Windows.Forms.Design/src/Resources/xlf/SR.zh-Hant.xlf index 159261f2c7f..7aba81b95ed 100644 --- a/src/System.Windows.Forms.Design/src/Resources/xlf/SR.zh-Hant.xlf +++ b/src/System.Windows.Forms.Design/src/Resources/xlf/SR.zh-Hant.xlf @@ -538,6 +538,111 @@ '{1}' 不是 '{0}' 的有效值。'{0}' 應該介於 {2} 與 {3} 之間。 + + Mask is not full. + Mask is not full. + + + + The provided MaskDescriptor is null. + The provided MaskDescriptor is null. + + + + One or more required properties are null or empty. + One or more required properties are null or empty. + + + + (none) + (none) + + + + <Custom> + <Custom> + + + + Data Format + Data Format + + + + Input Mask + Input Mask + + + + Mask Description + Mask Description + + + + Validating Type + Validating Type + + + + Set Mask... + Set Mask... + + + + Alphanumeric character expected + Alphanumeric character expected + + + + ASCII character expected + ASCII character expected + + + + Digit expected + Digit expected + + + + Invalid input character + Invalid input character + + + + Letter expected + Letter expected + + + + Non edit position + Non edit position + + + + Position out of range + Position out of range + + + + Prompt character disallowed as input + Prompt character disallowed as input + + + + Signed digit expected + Signed digit expected + + + + Unavailable edit position + Unavailable edit position + + + + Error at position {0}: {1}. + Error at position {0}: {1}. + + (None) (無) diff --git a/src/System.Windows.Forms.Design/src/System.Windows.Forms.Design.csproj b/src/System.Windows.Forms.Design/src/System.Windows.Forms.Design.csproj index 3d531ab25d5..aeb6d6e823e 100644 --- a/src/System.Windows.Forms.Design/src/System.Windows.Forms.Design.csproj +++ b/src/System.Windows.Forms.Design/src/System.Windows.Forms.Design.csproj @@ -17,6 +17,9 @@ true System + + System.Windows.Forms.Design + @@ -216,4 +219,14 @@ System.Windows.Forms.Design.BindingFormattingDialog.Arrow + + + True + True + MaskDesignerDialog.resx + + + UserControl + + diff --git a/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/MaskDescriptor.cs b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/MaskDescriptor.cs new file mode 100644 index 00000000000..acb6bf1611f --- /dev/null +++ b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/MaskDescriptor.cs @@ -0,0 +1,169 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.ComponentModel; +using System.Diagnostics; +using System.Globalization; +using System.Threading; + +namespace System.Windows.Forms.Design +{ + /// + /// MaskDescriptor abstract class defines the set of methods mask descriptors need to implement for the + /// MaskedTextBox.Mask UITypeEditor to include as options in the property editor. MaskDescriptor + /// types are discovered at designed time by querying the ITypeDiscoveryService service provider from + /// the UITypeEditor object. + /// + public abstract class MaskDescriptor + { + /// + /// The mask being described. + /// + public abstract string Mask { get; } + + /// + /// The friendly name of the mask descriptor. + /// Used also as the description for the mask. + /// + public abstract string Name { get; } + + /// + /// A sample text following the mask specification. + /// + public abstract string Sample { get; } + + /// + /// A Type representing the type providing validation for this mask. + /// + public abstract Type ValidatingType { get; } + + /// + /// The CultureInfo representing the locale the mask is designed for. + /// + public virtual CultureInfo Culture + { + get { return Thread.CurrentThread.CurrentCulture; } + } + + /// + /// Determines whether the specified mask descriptor is valid and hence can be added to the canned masks list. + /// A valid MaskDescriptor must meet the following conditions: + /// 1. Not null. + /// 2. Not null or empty mask. + /// 3. Not null or empty name. + /// 4. Not null or empty sample. + /// 5. The sample is correct based on the mask and all required edit characters have been provided (mask completed - not necessarily full). + /// 6. The sample is valid based on the ValidatingType object (if any). + /// + public static bool IsValidMaskDescriptor(MaskDescriptor maskDescriptor) + { + return IsValidMaskDescriptor(maskDescriptor, out string _); + } + + public static bool IsValidMaskDescriptor(MaskDescriptor maskDescriptor, out string validationErrorDescription) + { + validationErrorDescription = string.Empty; + + if (maskDescriptor == null) + { + validationErrorDescription = SR.MaskDescriptorNull; + return false; + } + + if (string.IsNullOrEmpty(maskDescriptor.Mask) || string.IsNullOrEmpty(maskDescriptor.Name) || string.IsNullOrEmpty(maskDescriptor.Sample)) + { + validationErrorDescription = SR.MaskDescriptorNullOrEmptyRequiredProperty; + return false; + } + + MaskedTextProvider maskedTextProvider = new MaskedTextProvider(maskDescriptor.Mask, maskDescriptor.Culture); + MaskedTextBox maskedTextBox = new MaskedTextBox(maskedTextProvider); + + maskedTextBox.SkipLiterals = true; + maskedTextBox.ResetOnPrompt = true; + maskedTextBox.ResetOnSpace = true; + maskedTextBox.ValidatingType = maskDescriptor.ValidatingType; + maskedTextBox.FormatProvider = maskDescriptor.Culture; + maskedTextBox.Culture = maskDescriptor.Culture; + maskedTextBox.TypeValidationCompleted += new TypeValidationEventHandler(maskedTextBox1_TypeValidationCompleted); + maskedTextBox.MaskInputRejected += new MaskInputRejectedEventHandler(maskedTextBox1_MaskInputRejected); + + // Add sample. If it fails we are done. + maskedTextBox.Text = maskDescriptor.Sample; + + if (maskedTextBox.Tag == null) // Sample was added successfully (MaskInputRejected event handler did not change the maskedTextBox tag). + { + if (maskDescriptor.ValidatingType != null) + { + maskedTextBox.ValidateText(); + } + } + + if (maskedTextBox.Tag != null) // Validation failed. + { + validationErrorDescription = maskedTextBox.Tag.ToString(); + } + + return validationErrorDescription.Length == 0; + } + + private static void maskedTextBox1_MaskInputRejected(object sender, MaskInputRejectedEventArgs e) + { + MaskedTextBox maskedTextBox = sender as MaskedTextBox; + maskedTextBox.Tag = MaskedTextBoxDesigner.GetMaskInputRejectedErrorMessage(e); + } + + private static void maskedTextBox1_TypeValidationCompleted(object sender, TypeValidationEventArgs e) + { + if (e.IsValidInput) + { + return; + } + + MaskedTextBox maskedTextBox = sender as MaskedTextBox; + maskedTextBox.Tag = e.Message; + } + + /// + /// Determines whether this mask descriptor and the passed object describe the same mask. + /// True if the following conditions are met in both, this and the passed object: + /// 1. Mask property is the same. + /// 2. Validating type is the same + /// Observe that the Name property is not considered since MaskedTextProvider/Box are not + /// aware of it. + /// + public override bool Equals(object maskDescriptor) + { + MaskDescriptor descriptor = maskDescriptor as MaskDescriptor; + + if (!IsValidMaskDescriptor(descriptor) || !IsValidMaskDescriptor(this)) + { + return this == maskDescriptor; // shallow comparison. + } + + return ((Mask == descriptor.Mask) && (ValidatingType == descriptor.ValidatingType)); + } + + public override int GetHashCode() + { + string hash = Mask; + + if (ValidatingType != null) + { + hash += ValidatingType.ToString(); + } + return hash.GetHashCode(); + } + + public override string ToString() + { + return string.Format(CultureInfo.CurrentCulture, "{0} + /// Implements the manual sorting of items by columns in the mask descriptor table. + /// Used by the MaskDesignerDialog to sort the items in the mask descriptors list. + /// + internal class MaskDescriptorComparer : IComparer + { + private SortOrder _sortOrder; + private SortType _sortType; + + public enum SortType + { + ByName, + BySample, + ByValidatingTypeName + } + + public MaskDescriptorComparer(SortType sortType, SortOrder sortOrder) + { + _sortType = sortType; + _sortOrder = sortOrder; + } + + public int Compare(MaskDescriptor maskDescriptorA, MaskDescriptor maskDescriptorB) + { + if (maskDescriptorA == null || maskDescriptorB == null) + { + // Since this is an internal class we cannot throw here, the user cannot do anything about this. + Debug.Fail("One or more parameters invalid"); + return 0; + } + + string textA, textB; + + switch (_sortType) + { + default: + Debug.Fail("Invalid SortType, defaulting to SortType.ByName"); + goto case SortType.ByName; + + case SortType.ByName: + textA = maskDescriptorA.Name; + textB = maskDescriptorB.Name; + break; + + case SortType.BySample: + textA = maskDescriptorA.Sample; + textB = maskDescriptorB.Sample; + break; + + case SortType.ByValidatingTypeName: + textA = maskDescriptorA.ValidatingType == null ? SR.MaskDescriptorValidatingTypeNone : maskDescriptorA.ValidatingType.Name; + textB = maskDescriptorB.ValidatingType == null ? SR.MaskDescriptorValidatingTypeNone : maskDescriptorB.ValidatingType.Name; + break; + } + + int retVal = string.Compare(textA, textB); + + return _sortOrder == SortOrder.Descending ? -retVal : retVal; + } + + public int GetHashCode(MaskDescriptor maskDescriptor) + { + if (maskDescriptor != null) + { + return maskDescriptor.GetHashCode(); + } + + Debug.Fail("Null maskDescriptor passed."); + return 0; + } + + public bool Equals(MaskDescriptor maskDescriptorA, MaskDescriptor maskDescriptorB) + { + if (!MaskDescriptor.IsValidMaskDescriptor(maskDescriptorA) || !MaskDescriptor.IsValidMaskDescriptor(maskDescriptorB)) + { + return maskDescriptorA == maskDescriptorB; // shallow comparison. + } + + return maskDescriptorA.Equals(maskDescriptorB); + } + } +} diff --git a/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/MaskDescriptorTemplate.cs b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/MaskDescriptorTemplate.cs new file mode 100644 index 00000000000..6acf30cc987 --- /dev/null +++ b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/MaskDescriptorTemplate.cs @@ -0,0 +1,328 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Collections.Generic; +using System.Globalization; + +namespace System.Windows.Forms.Design +{ + /// + /// The predefined mask descriptors to be shown in the mask designer dialog. + /// + internal class MaskDescriptorTemplate : MaskDescriptor + { + private readonly string _mask; + private readonly string _name; + private readonly string _sample; + private readonly Type _type; + private readonly CultureInfo _culture; + + public MaskDescriptorTemplate(string mask, string name, string sample, Type validatingType, CultureInfo culture) : + this(mask, name, sample, validatingType, culture, false) + { + } + + public MaskDescriptorTemplate(string mask, string name, string sample, Type validatingType, CultureInfo culture, bool skipValidation) + { + _mask = mask; + _name = name; + _sample = sample; + _type = validatingType; + _culture = culture; + + if (skipValidation) + { + return; + } + + string msg; + + if (!MaskDescriptor.IsValidMaskDescriptor(this, out msg)) + { + // Don't throw here, callers should check the Mask property for validity. See the ValidMaskDescriptorList below. + _mask = null; + } + } + + public override string Mask => _mask; + + public override string Name => _name; + + public override string Sample => _sample; + + public override Type ValidatingType => _type; + + public override CultureInfo Culture => _culture; + + /// + /// Get the canned mask descriptors according to the specified culture. + /// + public static List GetLocalizedMaskDescriptors(CultureInfo culture) + { + ValidMaskDescriptorList maskDescriptors = new ValidMaskDescriptorList(); + + // Note: MaskDescriptor.Sample should not contain culture-sensitive literals since they can fail the mask + // for some specific cultures. (ex: date separator). + + switch (culture.Parent.Name) + { + default: + culture = CultureInfo.InvariantCulture; + goto case "en"; + + //case "en-US": // English US. + case "en": // English. + /// Numeric. + maskDescriptors.Add(new MaskDescriptorTemplate("00000", "Numeric (5-digits)", "12345", typeof(Int32), culture)); + /// Phone Number. + maskDescriptors.Add(new MaskDescriptorTemplate("(999) 000-0000", "Phone number", "5745550123", null, culture)); + /// Phone Number No Area Code. + maskDescriptors.Add(new MaskDescriptorTemplate("000-0000", "Phone number no area code", "5550123", null, culture)); + /// Short Date. + maskDescriptors.Add(new MaskDescriptorTemplate("00/00/0000", "Short date", "12112003", typeof(DateTime), culture)); + /// Short Date and Time. + maskDescriptors.Add(new MaskDescriptorTemplate("00/00/0000 90:00", "Short date and time (US)", "121120031120", typeof(DateTime), culture)); + /// Social Security Number. + maskDescriptors.Add(new MaskDescriptorTemplate("000-00-0000", "Social security number", "000001234", null, culture)); + /// Time. + maskDescriptors.Add(new MaskDescriptorTemplate("90:00", "Time (US)", "1120", typeof(DateTime), culture)); + /// Time 24. + maskDescriptors.Add(new MaskDescriptorTemplate("00:00", "Time (European/Military)", "2320", typeof(DateTime), culture)); + /// Zip code. + maskDescriptors.Add(new MaskDescriptorTemplate("00000-9999", "Zip Code", "980526399", null, culture)); + break; + + //case "ar-SA": // Arabic Saudi Arabia. + case "ar": // Arabic. + /// Phone Number. + maskDescriptors.Add(new MaskDescriptorTemplate("(999)000-0000", "Phone Number", "0123456789", null, culture)); + /// Phone Number No Area Code. + maskDescriptors.Add(new MaskDescriptorTemplate("000-0000", "Phone Number no Area Code", "1234567", null, culture)); + /// Short Date. + maskDescriptors.Add(new MaskDescriptorTemplate("00 /00 /0000", "Short Date", "26102005", typeof(DateTime), culture)); + /// Short Date and Time. + maskDescriptors.Add(new MaskDescriptorTemplate("00 /00 /0000 00:00", "Short Date/Time", "261020051430", typeof(DateTime), culture)); + /// Social Security Number. + maskDescriptors.Add(new MaskDescriptorTemplate("000-00-0000", "Social Security Number", "123456789", null, culture)); + /// Time. + maskDescriptors.Add(new MaskDescriptorTemplate("90:00", "Time", " 230", typeof(DateTime), culture)); + /// Time 24. + maskDescriptors.Add(new MaskDescriptorTemplate("00:00", "Time (24 Hour)", "1430", typeof(DateTime), culture)); + break; + + //case "de-DE": // German Germany. + case "de": // German. + /// Short Date. + maskDescriptors.Add(new MaskDescriptorTemplate("00/00/0000", "Datum kurz", "28112005", typeof(DateTime), culture)); + /// Short Date and Time. + maskDescriptors.Add(new MaskDescriptorTemplate("00/00/0000 00:00", "Datum lang", "281120051430", typeof(DateTime), culture)); + /// Time. + maskDescriptors.Add(new MaskDescriptorTemplate("90:00", "Zeit", "1430", typeof(DateTime), culture)); + /// Zip code. + maskDescriptors.Add(new MaskDescriptorTemplate("00000", "Postleitzahl", "91450", null, culture)); + break; + + //case "fr-FR": // French. + case "fr": // French. + // Special-case date sample format for French-Canada. + string dateSample = culture.Name == "fr-CA" ? "11282005" : "28112005"; + /// Numeric. + maskDescriptors.Add(new MaskDescriptorTemplate("99999", "Numérique (5 chiffres)", "12345", typeof(Int32), culture)); + /// Phone Number. + maskDescriptors.Add(new MaskDescriptorTemplate("00 00 00 00 00 00", "Numéro de téléphone (France)", "0123456789", null, culture)); + /// Short Date. + maskDescriptors.Add(new MaskDescriptorTemplate("00/00/0000", "Date (format court)", dateSample, typeof(DateTime), culture)); + /// Short Date and Time. + maskDescriptors.Add(new MaskDescriptorTemplate("00/00/0000 00:00", "Date et heure (format long)", dateSample + "1430", typeof(DateTime), culture)); + /// Social Security Number. + maskDescriptors.Add(new MaskDescriptorTemplate("0 00 00 00 000 000 00", "Numéro de Sécurité Sociale (France)", "163117801234548", null, culture)); + /// Time. + maskDescriptors.Add(new MaskDescriptorTemplate("00:00", "Heure", "1430", typeof(DateTime), culture)); + /// Zip code. + maskDescriptors.Add(new MaskDescriptorTemplate("00000", "Code postal (France)", "91450", null, culture)); + break; + + //case "it-IT": // Italian Italy. + case "it": // Italian. + /// Numeric. + maskDescriptors.Add(new MaskDescriptorTemplate("99999", "Numerico (5 Cifre)", "12345", typeof(Int32), culture)); + /// Phone Number. + maskDescriptors.Add(new MaskDescriptorTemplate("0000 00000", "Numero di telefono", "012345678", null, culture)); + /// Mobile Phone Number. + maskDescriptors.Add(new MaskDescriptorTemplate("000 0000000", "Numero di cellulare", "1234567890", null, culture)); + /// Short Date. + maskDescriptors.Add(new MaskDescriptorTemplate("00/00/0000", "Data breve", "26102005", typeof(DateTime), culture)); + /// Short Date and Time. + maskDescriptors.Add(new MaskDescriptorTemplate("00/00/0000 00:00", "Data e ora", "261020051430", typeof(DateTime), culture)); + /// Time. + maskDescriptors.Add(new MaskDescriptorTemplate("00:00", "Ora", "1430", typeof(DateTime), culture)); + /// Zip code. + maskDescriptors.Add(new MaskDescriptorTemplate("00000", "Codice postale", "12345", null, culture)); + break; + + //case "es-ES": // Spanish Spain. + case "es": // Spanish. + /// Numeric. + maskDescriptors.Add(new MaskDescriptorTemplate("99999", "Numérico", "12345", typeof(Int32), culture)); + /// Phone Number. + maskDescriptors.Add(new MaskDescriptorTemplate("(999)000-0000", "Número de teléfono", "0123456789", null, culture)); + /// Mobile Phone Number. + maskDescriptors.Add(new MaskDescriptorTemplate("000-000-0000", "Número de teléfono móvil", "0001234567", null, culture)); + /// Phone Number No Area Code. + maskDescriptors.Add(new MaskDescriptorTemplate("000-0000", "Número de teléfono sin código de área", "1234567", null, culture)); + /// Short Date. + maskDescriptors.Add(new MaskDescriptorTemplate("00/00/0000", "Fecha", "26102005", typeof(DateTime), culture)); + /// Short Date and Time. + maskDescriptors.Add(new MaskDescriptorTemplate("00/00/0000 00:00", "Fecha y hora", "261020051430", typeof(DateTime), culture)); + /// Social Security Number. + maskDescriptors.Add(new MaskDescriptorTemplate("000-00-0000", "Número del seguro social", "123456789", null, culture)); + /// Time. + maskDescriptors.Add(new MaskDescriptorTemplate("00:00", "Hora", "0830", typeof(DateTime), culture)); + /// Zip code. + maskDescriptors.Add(new MaskDescriptorTemplate("00000", "Código postal", "12345", null, culture)); + break; + + //case "ja-JP": // Japanese. + case "ja": // Japanese. + /// Numeric. + maskDescriptors.Add(new MaskDescriptorTemplate("99999", "数値(5桁)", "12345", typeof(Int32), culture)); + /// Phone Number. + maskDescriptors.Add(new MaskDescriptorTemplate("99900-9990-0000", "電話番号", " 012- 345-6789", null, culture)); + /// Mobile Phone Number. + maskDescriptors.Add(new MaskDescriptorTemplate("000-0000-0000", "携帯電話番号", "00001234567", null, culture)); + /// Short Date. + maskDescriptors.Add(new MaskDescriptorTemplate("0000/00/00", "日付(西暦)", "20050620", typeof(DateTime), culture)); + /// Short Date and Time. + maskDescriptors.Add(new MaskDescriptorTemplate("0000/00/00 00:00:00", "日付と時間(西暦)", "2005/06/11 04:33:22", typeof(DateTime), culture)); + /// Time. + maskDescriptors.Add(new MaskDescriptorTemplate("90:00", "時間", " 633", typeof(DateTime), culture)); + /// Zip code. + maskDescriptors.Add(new MaskDescriptorTemplate("000-0000", "郵便番号", "1820021", null, culture)); + /// Calendar Gregorian. + maskDescriptors.Add(new MaskDescriptorTemplate("0000年90月90日", "日付(西暦、日本語)", "2005年 6月11日", typeof(DateTime), culture)); + /// Short date Japanese Calendar. + maskDescriptors.Add(new MaskDescriptorTemplate("00/00/00", "日付(和暦)", "170611", typeof(DateTime), culture)); + /// Calendar Japanese with Era. + maskDescriptors.Add(new MaskDescriptorTemplate("AA90年90月90日", "日付(和暦、日本語)", "平成17年 6月11日", typeof(DateTime), culture)); + /// Short Date Time Japanese. + maskDescriptors.Add(new MaskDescriptorTemplate("0000年90月90日 90時90分", "日付と時間(日本語)", "2005年 6月11日 3時33分", typeof(DateTime), culture)); + /// Short Date Time Era Calendar. + maskDescriptors.Add(new MaskDescriptorTemplate("00/00/00 00:00:00", "日付と時間(和暦)", "170611043322", typeof(DateTime), culture)); + /// Short Date Time Japanese Era Calendar. + maskDescriptors.Add(new MaskDescriptorTemplate("AA00年90月90日 90時90分", "日付と時間(和暦、日本語)", "平成17年 6月11日 3時33分", typeof(DateTime), culture)); + /// Time Japanese. + maskDescriptors.Add(new MaskDescriptorTemplate("90時90分", "時間(日本語)", " 633", typeof(DateTime), culture)); + break; + + //case "zh-CN": // People's Republic of China. + case "zh-CHS": // Simplified Chinese. + case "zh-Hans": // New name of Simplified Chinese. + /// Numeric. + maskDescriptors.Add(new MaskDescriptorTemplate("99999", "数字(最长5位)", "12345", typeof(Int32), culture)); + /// Phone Number. + maskDescriptors.Add(new MaskDescriptorTemplate("(900)9000-0000", "(区号)电话号码", " 1234567890", null, culture)); + /// Phone Number No Area Code. + maskDescriptors.Add(new MaskDescriptorTemplate("9000-0000", "电话号码", "12345678", null, culture)); + /// Mobile Phone Number. + maskDescriptors.Add(new MaskDescriptorTemplate("000-0000-0000", "移动电话号码", "12345678901", null, culture)); + /// Short Date. + maskDescriptors.Add(new MaskDescriptorTemplate("0000-00-00", "短日期格式", "20050611", typeof(DateTime), culture)); + /// Long Date. + maskDescriptors.Add(new MaskDescriptorTemplate("0000年90月90日", "长日期格式", "20051211", typeof(DateTime), culture)); + /// Short Date and Time. + maskDescriptors.Add(new MaskDescriptorTemplate("0000-00-00 90:00:00", "短日期时间", "2005-06-11 6:30:22", typeof(DateTime), culture)); + /// Long Date Time Chinese + maskDescriptors.Add(new MaskDescriptorTemplate("0000年90月90日 90时00分", "长日期时间", "2005年 6月11日 6时33分", typeof(DateTime), culture)); + /// Short Social Security Number. + maskDescriptors.Add(new MaskDescriptorTemplate("000000-000000-000", "15位身份证号码", "123456789012345", null, culture)); + /// Long Social Security Number. + maskDescriptors.Add(new MaskDescriptorTemplate("000000-00000000-000A", "18位身份证号码", "123456789012345678", null, culture)); + /// Time. + maskDescriptors.Add(new MaskDescriptorTemplate("90:00", "时间格式", " 633", typeof(DateTime), culture)); + /// Time Chienese. + maskDescriptors.Add(new MaskDescriptorTemplate("90时90分", "中文时间格式", " 6时33分", typeof(DateTime), culture)); + /// Zip code. + maskDescriptors.Add(new MaskDescriptorTemplate("000000", "邮政编码", "100080", null, culture)); + break; + + //case "zh-TW": // Chinese (Taiwan). + case "zh-CHT": // Tradicional Chinese. + case "zh-Hant": // New name of Tradictional Chinese. + /// Phone Number. + maskDescriptors.Add(new MaskDescriptorTemplate("(00)9000-0000", "電話號碼", "01 2345678", null, culture)); + /// Mobile Phone Number. + maskDescriptors.Add(new MaskDescriptorTemplate("0000-000-000", "行動電話號碼", "1234567890", null, culture)); + /// Short Date. + maskDescriptors.Add(new MaskDescriptorTemplate("0000/00/00", "西曆簡短日期", "20050620", typeof(DateTime), culture)); + /// Short Date Chinese. + maskDescriptors.Add(new MaskDescriptorTemplate("0000年90月90日", "西曆完整日期", "2005年10月 2日", typeof(DateTime), culture)); + /// Short Date and Time. + maskDescriptors.Add(new MaskDescriptorTemplate("0000/00/00 00:00:00", "西曆簡短日期時間", "20050611043322", typeof(DateTime), culture)); + /// Short Date Time Chinese. + maskDescriptors.Add(new MaskDescriptorTemplate("0000年90月90日 90時90分", "西曆完整日期時間", "2005年 6月 2日 6時22分", typeof(DateTime), culture)); + /// Social Security Number. + maskDescriptors.Add(new MaskDescriptorTemplate("L000000000", "身分證字號", "A123456789", null, culture)); + /// Time. + maskDescriptors.Add(new MaskDescriptorTemplate("90:00", "時間格式", " 633", typeof(DateTime), culture)); + /// Time Chinese. + maskDescriptors.Add(new MaskDescriptorTemplate("90時90分", "中文時間格式", " 6時 3分", typeof(DateTime), culture)); + /// Zip code. + maskDescriptors.Add(new MaskDescriptorTemplate("99000", "3+2郵遞區號", "80407", null, culture)); + break; + + //case "ko-KR": // Korean. + case "ko": // Korean. + /// Numeric. + maskDescriptors.Add(new MaskDescriptorTemplate("99999", "숫자(5자리)", "12345", typeof(Int32), culture)); + /// Phone Number. + maskDescriptors.Add(new MaskDescriptorTemplate("(999)9000-0000", "전화 번호", "01234567890", null, culture)); + /// Mobile Phone Number. + maskDescriptors.Add(new MaskDescriptorTemplate("000-9000-0000", "휴대폰 번호", "01012345678", null, culture)); + /// Phone Number No Area Code. + maskDescriptors.Add(new MaskDescriptorTemplate("9000-0000", "지역 번호를 제외한 전화 번호", "12345678", null, culture)); + /// Short Date. + maskDescriptors.Add(new MaskDescriptorTemplate("0000-00-00", "간단한 날짜", "20050620", typeof(DateTime), culture)); + /// Short date and time. + maskDescriptors.Add(new MaskDescriptorTemplate("0000-00-00 90:00", "간단한 날짜 및 시간", "2005-06-20 9:20", typeof(DateTime), culture)); + /// Long Date Time. + maskDescriptors.Add(new MaskDescriptorTemplate("0000년90월90일 90시90분", "자세한 날짜 및 시간", "2005년 6월20일 6시33분", typeof(DateTime), culture)); + /// Social Security Number. + maskDescriptors.Add(new MaskDescriptorTemplate("000000-0000000", "주민 등록 번호", "1234561234567", null, culture)); + /// Time. + maskDescriptors.Add(new MaskDescriptorTemplate("90:00", "시간", " 633", typeof(DateTime), culture)); + /// Zip code. + maskDescriptors.Add(new MaskDescriptorTemplate("000-000", "우편 번호", "182021", null, culture)); + /// Long Time. + maskDescriptors.Add(new MaskDescriptorTemplate("90시90분", "자세한 시간", " 6시33분", typeof(DateTime), culture)); + /// Long Date. + maskDescriptors.Add(new MaskDescriptorTemplate("0000년 90월 90일", "자세한 날짜", "20050620", typeof(DateTime), culture)); + break; + } + + return maskDescriptors.List; + } + + /// + /// This class is a List wrapper which accepts only valid MaskDescriptor objects. + /// + private class ValidMaskDescriptorList + { + /// + /// Adds the specified MaskDescriptorTemplate object provided it is a valid one. + /// + public void Add(MaskDescriptorTemplate maskDescriptorTemplate) + { + if (maskDescriptorTemplate.Mask != null) + { + List.Add(maskDescriptorTemplate); + } + } + + /// + /// Returns a reference to the internal List object. + /// + public List List { get; } = new List(); + } + } +} diff --git a/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/MaskDesignerDialog.cs b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/MaskDesignerDialog.cs new file mode 100644 index 00000000000..7ec97382bfa --- /dev/null +++ b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/MaskDesignerDialog.cs @@ -0,0 +1,711 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Collections; +using System.Collections.Generic; +using System.ComponentModel; +using System.ComponentModel.Design; +using System.Diagnostics; +using System.Globalization; + +namespace System.Windows.Forms.Design +{ + /// + /// UI for the MaskTypeEditor (Design time). + /// + internal class MaskDesignerDialog : Form + { + private Label _lblHeader; + private ListView _listViewCannedMasks; + private CheckBox _checkBoxUseValidatingType; + private ColumnHeader _maskDescriptionHeader; + private ColumnHeader _dataFormatHeader; + private ColumnHeader _validatingTypeHeader; + private TableLayoutPanel _maskTryItTable; + private Label _lblMask; + private TextBox _txtBoxMask; + private Label _lblTryIt; + private readonly MaskedTextBox _maskedTextBox; + private TableLayoutPanel _okCancelTableLayoutPanel; + private TableLayoutPanel _overarchingTableLayoutPanel; + private Button _btnOK; + private Button _btnCancel; + private ErrorProvider _errorProvider; + + private readonly List _maskDescriptors = new List(); + private MaskDescriptor _customMaskDescriptor; + private SortOrder _listViewSortOrder = SortOrder.Ascending; + private IContainer _components; + private readonly IHelpService _helpService = null; + + /// + /// Constructor receiving a clone of the MaskedTextBox control under design. + /// + public MaskDesignerDialog(MaskedTextBox instance, IHelpService helpService) + { + if (instance == null) + { + Debug.Fail("Null masked text box, creating default."); + _maskedTextBox = new MaskedTextBox(); + } + else + { + _maskedTextBox = MaskedTextBoxDesigner.GetDesignMaskedTextBox(instance); + } + + _helpService = helpService; + + InitializeComponent(); + + // Enable Vista Explorer listview style + DesignerUtils.ApplyListViewThemeStyles(_listViewCannedMasks); + + // Non-designer-handled stuff. + SuspendLayout(); + + _txtBoxMask.Text = _maskedTextBox.Mask; + + // Add default mask descriptors to the mask description list. + AddDefaultMaskDescriptors(_maskedTextBox.Culture); + + // + // maskDescriptionHeader + // + _maskDescriptionHeader.Text = SR.MaskDesignerDialogMaskDescription; + _maskDescriptionHeader.Width = _listViewCannedMasks.Width / 3; + // + // dataFormatHeader + // + _dataFormatHeader.Text = SR.MaskDesignerDialogDataFormat; + _dataFormatHeader.Width = _listViewCannedMasks.Width / 3; + // + // validatingTypeHeader + // + _validatingTypeHeader.Text = SR.MaskDesignerDialogValidatingType; + _validatingTypeHeader.Width = (_listViewCannedMasks.Width / 3) - SystemInformation.VerticalScrollBarWidth - 4; // so no h-scrollbar. + ResumeLayout(false); + + HookEvents(); + } + + private void HookEvents() + { + _listViewCannedMasks.SelectedIndexChanged += new EventHandler(listViewCannedMasks_SelectedIndexChanged); + _listViewCannedMasks.ColumnClick += new ColumnClickEventHandler(listViewCannedMasks_ColumnClick); + _listViewCannedMasks.Enter += new EventHandler(listViewCannedMasks_Enter); + _btnOK.Click += new EventHandler(btnOK_Click); + _txtBoxMask.TextChanged += new EventHandler(txtBoxMask_TextChanged); + _txtBoxMask.Validating += new CancelEventHandler(txtBoxMask_Validating); + _maskedTextBox.KeyDown += new KeyEventHandler(maskedTextBox_KeyDown); + _maskedTextBox.MaskInputRejected += new MaskInputRejectedEventHandler(maskedTextBox_MaskInputRejected); + Load += new EventHandler(MaskDesignerDialog_Load); + HelpButtonClicked += new CancelEventHandler(MaskDesignerDialog_HelpButtonClicked); + } + + private void InitializeComponent() + { + _components = new Container(); + ComponentResourceManager resources = new ComponentResourceManager(typeof(MaskDesignerDialog)); + _lblHeader = new Label(); + _listViewCannedMasks = new ListView(); + _maskDescriptionHeader = new ColumnHeader(resources.GetString("listViewCannedMasks.Columns")); + _dataFormatHeader = new ColumnHeader(resources.GetString("listViewCannedMasks.Columns1")); + _validatingTypeHeader = new ColumnHeader(resources.GetString("listViewCannedMasks.Columns2")); + _btnOK = new Button(); + _btnCancel = new Button(); + _checkBoxUseValidatingType = new CheckBox(); + _maskTryItTable = new TableLayoutPanel(); + _lblMask = new Label(); + _txtBoxMask = new TextBox(); + _lblTryIt = new Label(); + _overarchingTableLayoutPanel = new TableLayoutPanel(); + _okCancelTableLayoutPanel = new TableLayoutPanel(); + _errorProvider = new ErrorProvider(_components); + _maskTryItTable.SuspendLayout(); + _overarchingTableLayoutPanel.SuspendLayout(); + _okCancelTableLayoutPanel.SuspendLayout(); + ((ISupportInitialize)(_errorProvider)).BeginInit(); + SuspendLayout(); + // + // maskedTextBox + // + resources.ApplyResources(_maskedTextBox, "maskedTextBox"); + _maskedTextBox.Margin = new Padding(3, 3, 18, 0); + _maskedTextBox.Name = "maskedTextBox"; + // + // lblHeader + // + resources.ApplyResources(_lblHeader, "lblHeader"); + _lblHeader.Margin = new Padding(0, 0, 0, 3); + _lblHeader.Name = "lblHeader"; + // + // listViewCannedMasks + // + resources.ApplyResources(_listViewCannedMasks, "listViewCannedMasks"); + _listViewCannedMasks.Columns.AddRange(new ColumnHeader[] { + _maskDescriptionHeader, + _dataFormatHeader, + _validatingTypeHeader}); + _listViewCannedMasks.FullRowSelect = true; + _listViewCannedMasks.HideSelection = false; + _listViewCannedMasks.Margin = new Padding(0, 3, 0, 3); + _listViewCannedMasks.MultiSelect = false; + _listViewCannedMasks.Name = "listViewCannedMasks"; + _listViewCannedMasks.Sorting = SortOrder.None; // We'll do the sorting ourselves. + _listViewCannedMasks.View = View.Details; + // + // maskDescriptionHeader + // + resources.ApplyResources(_maskDescriptionHeader, "maskDescriptionHeader"); + // + // dataFormatHeader + // + resources.ApplyResources(_dataFormatHeader, "dataFormatHeader"); + // + // validatingTypeHeader + // + resources.ApplyResources(_validatingTypeHeader, "validatingTypeHeader"); + // + // btnOK + // + resources.ApplyResources(_btnOK, "btnOK"); + _btnOK.DialogResult = DialogResult.OK; + _btnOK.Margin = new Padding(0, 0, 3, 0); + _btnOK.MinimumSize = new Drawing.Size(75, 23); + _btnOK.Name = "btnOK"; + _btnOK.Padding = new Padding(10, 0, 10, 0); + // + // btnCancel + // + resources.ApplyResources(_btnCancel, "btnCancel"); + _btnCancel.DialogResult = DialogResult.Cancel; + _btnCancel.Margin = new Padding(3, 0, 0, 0); + _btnCancel.MinimumSize = new Drawing.Size(75, 23); + _btnCancel.Name = "btnCancel"; + _btnCancel.Padding = new Padding(10, 0, 10, 0); + // + // checkBoxUseValidatingType + // + resources.ApplyResources(_checkBoxUseValidatingType, "checkBoxUseValidatingType"); + _checkBoxUseValidatingType.Checked = true; + _checkBoxUseValidatingType.CheckState = CheckState.Checked; + _checkBoxUseValidatingType.Margin = new Padding(0, 0, 0, 3); + _checkBoxUseValidatingType.Name = "checkBoxUseValidatingType"; + // + // maskTryItTable + // + resources.ApplyResources(_maskTryItTable, "maskTryItTable"); + _maskTryItTable.ColumnStyles.Add(new ColumnStyle()); + _maskTryItTable.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100F)); + _maskTryItTable.ColumnStyles.Add(new ColumnStyle()); + _maskTryItTable.Controls.Add(_checkBoxUseValidatingType, 2, 0); + _maskTryItTable.Controls.Add(_lblMask, 0, 0); + _maskTryItTable.Controls.Add(_txtBoxMask, 1, 0); + _maskTryItTable.Controls.Add(_lblTryIt, 0, 1); + _maskTryItTable.Controls.Add(_maskedTextBox, 1, 1); + _maskTryItTable.Margin = new Padding(0, 3, 0, 3); + _maskTryItTable.Name = "maskTryItTable"; + _maskTryItTable.RowStyles.Add(new RowStyle()); + _maskTryItTable.RowStyles.Add(new RowStyle()); + // + // lblMask + // + resources.ApplyResources(_lblMask, "lblMask"); + _lblMask.Margin = new Padding(0, 0, 3, 3); + _lblMask.Name = "lblMask"; + // + // txtBoxMask + // + resources.ApplyResources(_txtBoxMask, "txtBoxMask"); + _txtBoxMask.Margin = new Padding(3, 0, 18, 3); + _txtBoxMask.Name = "txtBoxMask"; + // + // lblTryIt + // + resources.ApplyResources(_lblTryIt, "lblTryIt"); + _lblTryIt.Margin = new Padding(0, 3, 3, 0); + _lblTryIt.Name = "lblTryIt"; + // + // overarchingTableLayoutPanel + // + resources.ApplyResources(_overarchingTableLayoutPanel, "overarchingTableLayoutPanel"); + _overarchingTableLayoutPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50F)); + _overarchingTableLayoutPanel.Controls.Add(_maskTryItTable, 0, 3); + _overarchingTableLayoutPanel.Controls.Add(_okCancelTableLayoutPanel, 0, 4); + _overarchingTableLayoutPanel.Controls.Add(_lblHeader, 0, 1); + _overarchingTableLayoutPanel.Controls.Add(_listViewCannedMasks, 0, 2); + _overarchingTableLayoutPanel.Name = "overarchingTableLayoutPanel"; + _overarchingTableLayoutPanel.RowStyles.Add(new RowStyle()); + _overarchingTableLayoutPanel.RowStyles.Add(new RowStyle()); + _overarchingTableLayoutPanel.RowStyles.Add(new RowStyle(SizeType.Percent, 50F)); + _overarchingTableLayoutPanel.RowStyles.Add(new RowStyle()); + _overarchingTableLayoutPanel.RowStyles.Add(new RowStyle()); + // + // okCancelTableLayoutPanel + // + resources.ApplyResources(_okCancelTableLayoutPanel, "okCancelTableLayoutPanel"); + _okCancelTableLayoutPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50F)); + _okCancelTableLayoutPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50F)); + _okCancelTableLayoutPanel.Controls.Add(_btnCancel, 1, 0); + _okCancelTableLayoutPanel.Controls.Add(_btnOK, 0, 0); + _okCancelTableLayoutPanel.Margin = new Padding(0, 6, 0, 0); + _okCancelTableLayoutPanel.Name = "okCancelTableLayoutPanel"; + _okCancelTableLayoutPanel.RowStyles.Add(new RowStyle()); + // + // errorProvider + // + _errorProvider.BlinkStyle = ErrorBlinkStyle.NeverBlink; + _errorProvider.ContainerControl = this; + // + // MaskDesignerDialog + // + resources.ApplyResources(this, "$this"); + AcceptButton = _btnOK; + CancelButton = _btnCancel; + AutoScaleMode = AutoScaleMode.Font; + Controls.Add(_overarchingTableLayoutPanel); + FormBorderStyle = FormBorderStyle.FixedDialog; + HelpButton = true; + MaximizeBox = false; + MinimizeBox = false; + Name = "MaskDesignerDialog"; + ShowInTaskbar = false; + SizeGripStyle = SizeGripStyle.Hide; + _maskTryItTable.ResumeLayout(false); + _maskTryItTable.PerformLayout(); + _overarchingTableLayoutPanel.ResumeLayout(false); + _overarchingTableLayoutPanel.PerformLayout(); + _okCancelTableLayoutPanel.ResumeLayout(false); + _okCancelTableLayoutPanel.PerformLayout(); + ((ISupportInitialize)(_errorProvider)).EndInit(); + ResumeLayout(false); + + } + + /// + /// The current text (mask) in the txtBoxMask control. + /// + public string Mask => _maskedTextBox.Mask; + + /// + /// The current text (mask) in the txtBoxMask control. + /// + public Type ValidatingType { get; private set; } + + /// + /// A collection of MaskDescriptor objects represented in the ListView with the canned mask + /// descriptions. + /// + public IEnumerator MaskDescriptors => _maskDescriptors.GetEnumerator(); + + /// + /// Adds the default mask descriptors to the mask description list. + /// We need to add the deafult descriptors explicitly because the DiscoverMaskDescriptors method only adds + /// public descriptors and these are internal. + /// + private void AddDefaultMaskDescriptors(CultureInfo culture) + { + _customMaskDescriptor = new MaskDescriptorTemplate(null, SR.MaskDesignerDialogCustomEntry, null, null, null, true); + + List maskDescriptors = MaskDescriptorTemplate.GetLocalizedMaskDescriptors(culture); + + // Need to pass false for validateDescriptor param since the custom mask will fail validation + // because the mask is empty. + InsertMaskDescriptor(0, _customMaskDescriptor, /*validate*/ false); + + foreach (MaskDescriptor maskDescriptor in maskDescriptors) + { + InsertMaskDescriptor(0, maskDescriptor); + } + } + + /// + /// Determines whether the specified MaskDescriptor object is in the MaskDescriptor collection or not. + /// + private bool ContainsMaskDescriptor(MaskDescriptor maskDescriptor) + { + Debug.Assert(maskDescriptor != null, "Null mask descriptor."); + + foreach (MaskDescriptor descriptor in _maskDescriptors) + { + Debug.Assert(descriptor != null, "Null mask descriptor in the collection."); + + if (maskDescriptor.Equals(descriptor) || maskDescriptor.Name.Trim() == descriptor.Name.Trim()) + { + return true; + } + } + + return false; + } + + /// + /// Uses the specified ITypeDiscoveryService service provider to discover MaskDescriptor objects from + /// the referenced assemblies. + /// + public void DiscoverMaskDescriptors(ITypeDiscoveryService discoveryService) + { + if (discoveryService == null) + { + return; + } + + ICollection descriptors = DesignerUtils.FilterGenericTypes(discoveryService.GetTypes(typeof(MaskDescriptor), false /* excludeGlobalTypes */)); + + // Note: This code assumes DesignerUtils.FilterGenericTypes return a valid ICollection (collection of MaskDescriptor types). + foreach (Type t in descriptors) + { + if (t.IsAbstract || !t.IsPublic) + { + continue; + } + + // Since mask descriptors can be provided from external sources, we need to guard against + // possible exceptions when accessing an external descriptor. + try + { + MaskDescriptor maskDescriptor = (MaskDescriptor)Activator.CreateInstance(t); + InsertMaskDescriptor(0, maskDescriptor); + } + catch (Exception ex) + { + if (ClientUtils.IsCriticalException(ex)) + { + throw; + } + } + } + } + + /// + /// Gets the index of a mask descriptor in the mask descriptor table. + /// + private int GetMaskDescriptorIndex(MaskDescriptor maskDescriptor) + { + for (int index = 0; index < _maskDescriptors.Count; index++) + { + MaskDescriptor descriptor = _maskDescriptors[index]; + + if (descriptor == maskDescriptor) + { + return index; + } + } + + Debug.Fail("Could not find mask descriptor."); + return -1; + } + + /// + /// Selects the mask descriptor corresponding to the current MaskedTextBox.Mask if any, otherwise the custom entry. + /// + private void SelectMtbMaskDescriptor() + { + int selectedItemIdx = -1; + + if (!string.IsNullOrEmpty(_maskedTextBox.Mask)) + { + for (int selectedIndex = 0; selectedIndex < _maskDescriptors.Count; selectedIndex++) + { + MaskDescriptor descriptor = _maskDescriptors[selectedIndex]; + + if (descriptor.Mask == _maskedTextBox.Mask && descriptor.ValidatingType == _maskedTextBox.ValidatingType) + { + selectedItemIdx = selectedIndex; + break; + } + } + } + + if (selectedItemIdx == -1) // select custom mask. + { + selectedItemIdx = GetMaskDescriptorIndex(_customMaskDescriptor); + + if (selectedItemIdx == -1) + { + Debug.Fail("Could not find custom mask descriptor."); + } + } + + if (selectedItemIdx != -1) + { + SetSelectedMaskDescriptor(selectedItemIdx); + } + } + + /// + /// Selects the specified item in the ListView. + /// + private void SetSelectedMaskDescriptor(MaskDescriptor maskDex) + { + int maskDexIndex = GetMaskDescriptorIndex(maskDex); + SetSelectedMaskDescriptor(maskDexIndex); + } + private void SetSelectedMaskDescriptor(int maskDexIndex) + { + if (maskDexIndex < 0 || _listViewCannedMasks.Items.Count <= maskDexIndex) + { + return; + } + + _listViewCannedMasks.Items[maskDexIndex].Selected = true; + _listViewCannedMasks.FocusedItem = _listViewCannedMasks.Items[maskDexIndex]; + _listViewCannedMasks.EnsureVisible(maskDexIndex); + } + + /// + /// Sorts the maskDescriptors and the list view items. + /// + private void UpdateSortedListView(MaskDescriptorComparer.SortType sortType) + { + if (!_listViewCannedMasks.IsHandleCreated) + { + return; + } + + MaskDescriptor selectedMaskDex = null; + + // Save current selected entry to restore it after sorting. + if (_listViewCannedMasks.SelectedItems.Count > 0) + { + int selectedIndex = _listViewCannedMasks.SelectedIndices[0]; + selectedMaskDex = _maskDescriptors[selectedIndex]; + } + + // Custom mask descriptor should always be the last entry - remove it before sorting array. + _maskDescriptors.RemoveAt(_maskDescriptors.Count - 1); + + // Sort MaskDescriptor collection. + _maskDescriptors.Sort(new MaskDescriptorComparer(sortType, _listViewSortOrder)); + + // Sorting the ListView items forces handle recreation, since we have the items sorted and know what item to select + // it is better for us to replace the items ourselves. This way also avoids problems with the selected item and + // the custom entry not getting properly added. + // this.listViewCannedMasks.Sort(); + + // Since we need to pre-process each item before inserting it in the ListView, it is better to remove all items + // from it first and then add the sorted ones back (no replace). Stop redrawing while we change the list. + + UnsafeNativeMethods.SendMessage(_listViewCannedMasks.Handle, Interop.WindowMessages.WM_SETREDRAW, false, /* unused = */ 0); + + try + { + _listViewCannedMasks.Items.Clear(); + + string nullEntry = SR.MaskDescriptorValidatingTypeNone; + + foreach (MaskDescriptor maskDescriptor in _maskDescriptors) + { + string validatingType = maskDescriptor.ValidatingType != null ? maskDescriptor.ValidatingType.Name : nullEntry; + + // Make sure the sample displays literals. + MaskedTextProvider mtp = new MaskedTextProvider(maskDescriptor.Mask, maskDescriptor.Culture); + bool success = mtp.Add(maskDescriptor.Sample); + Debug.Assert(success, "BadBad: Could not add MaskDescriptor.Sample even it was validated, something is wrong!"); + // Don't include prompt. + string sample = mtp.ToString(false, true); + + _listViewCannedMasks.Items.Add(new ListViewItem(new string[] { maskDescriptor.Name, sample, validatingType })); + } + + // Add the custom mask descriptor as the last entry. + _maskDescriptors.Add(_customMaskDescriptor); + _listViewCannedMasks.Items.Add(new ListViewItem(new string[] { _customMaskDescriptor.Name, "", nullEntry })); + + if (selectedMaskDex != null) + { + SetSelectedMaskDescriptor(selectedMaskDex); + } + } + finally + { + // Resume redraw. + UnsafeNativeMethods.SendMessage(_listViewCannedMasks.Handle, Interop.WindowMessages.WM_SETREDRAW, true, /* unused = */ 0); + _listViewCannedMasks.Invalidate(); + } + } + + /// + /// Inserts a MaskDescriptor object in the specified position in the internal MaskDescriptor collection. + /// + private void InsertMaskDescriptor(int index, MaskDescriptor maskDescriptor) + { + InsertMaskDescriptor(index, maskDescriptor, true); + } + private void InsertMaskDescriptor(int index, MaskDescriptor maskDescriptor, bool validateDescriptor) + { + string errorMessage; + + if (validateDescriptor && !MaskDescriptor.IsValidMaskDescriptor(maskDescriptor, out errorMessage)) + { + return; + } + + if (!ContainsMaskDescriptor(maskDescriptor)) + { + _maskDescriptors.Insert(index, maskDescriptor); + } + } + + /// + /// Canned masks list view Column click event handler. Sorts the items. + /// + private void listViewCannedMasks_ColumnClick(object sender, ColumnClickEventArgs e) + { + // Switch sorting order. + switch (_listViewSortOrder) + { + case SortOrder.None: + case SortOrder.Descending: + _listViewSortOrder = SortOrder.Ascending; + break; + case SortOrder.Ascending: + _listViewSortOrder = SortOrder.Descending; + break; + } + + UpdateSortedListView((MaskDescriptorComparer.SortType)e.Column); + } + + /// + /// OK button Click event handler. Updates the validating type. + /// + private void btnOK_Click(object sender, EventArgs e) + { + if (_checkBoxUseValidatingType.Checked) + { + ValidatingType = _maskedTextBox.ValidatingType; + } + else + { + ValidatingType = null; + } + } + + /// + /// Canned masks list view Enter event handler. Sets focus in the first item if none has it. + /// + private void listViewCannedMasks_Enter(object sender, EventArgs e) + { + if (_listViewCannedMasks.FocusedItem != null || _listViewCannedMasks.Items.Count <= 0) + { + return; + } + + _listViewCannedMasks.Items[0].Focused = true; + } + + /// + /// Canned masks list view SelectedIndexChanged event handler. Gets the selected canned mask + /// information. + /// + private void listViewCannedMasks_SelectedIndexChanged(object sender, EventArgs e) + { + if (_listViewCannedMasks.SelectedItems.Count == 0) + { + return; + } + + int selectedIndex = _listViewCannedMasks.SelectedIndices[0]; + MaskDescriptor maskDescriptor = (MaskDescriptor)_maskDescriptors[selectedIndex]; + + // If one of the canned mask descriptors chosen, update test control. + if (maskDescriptor != _customMaskDescriptor) + { + _txtBoxMask.Text = maskDescriptor.Mask; + _maskedTextBox.Mask = maskDescriptor.Mask; + _maskedTextBox.ValidatingType = maskDescriptor.ValidatingType; + } + else + { + _maskedTextBox.ValidatingType = null; + } + } + + private void MaskDesignerDialog_Load(object sender, EventArgs e) + { + UpdateSortedListView(MaskDescriptorComparer.SortType.ByName); + SelectMtbMaskDescriptor(); + _btnCancel.Select(); + } + + private void maskedTextBox_MaskInputRejected(object sender, MaskInputRejectedEventArgs e) + { + _errorProvider.SetError(_maskedTextBox, MaskedTextBoxDesigner.GetMaskInputRejectedErrorMessage(e)); + } + + private string HelpTopic + { + get + { + return "net.ComponentModel.MaskPropertyEditor"; + } + } + + /// + /// + /// Called when the help button is clicked. + /// + /// + private void ShowHelp() + { + if (_helpService != null) + { + _helpService.ShowHelpFromKeyword(HelpTopic); + } + else + { + Debug.Fail("Unable to get IHelpService."); + } + } + + private void MaskDesignerDialog_HelpButtonClicked(object sender, CancelEventArgs e) + { + e.Cancel = true; + ShowHelp(); + } + + private void maskedTextBox_KeyDown(object sender, KeyEventArgs e) + { + _errorProvider.Clear(); + } + + /// + /// Mask text box Leave event handler. + /// + private void txtBoxMask_Validating(object sender, CancelEventArgs e) + { + try + { + _maskedTextBox.Mask = _txtBoxMask.Text; + } + catch (ArgumentException) + { + // The text in the TextBox may contain invalid characters so we just ignore the exception. + } + } + + /// + /// Mask text box TextChanged event handler. + /// + private void txtBoxMask_TextChanged(object sender, EventArgs e) + { + // If the change in the text box is performed by the user, we need to select the 'Custom' item in + // the list view, which is the last item. + + MaskDescriptor selectedMaskDex = null; + + if (_listViewCannedMasks.SelectedItems.Count != 0) + { + int selectedIndex = _listViewCannedMasks.SelectedIndices[0]; + selectedMaskDex = _maskDescriptors[selectedIndex]; + } + + if (selectedMaskDex == null || (selectedMaskDex != _customMaskDescriptor && selectedMaskDex.Mask != _txtBoxMask.Text)) + { + SetSelectedMaskDescriptor(_customMaskDescriptor); + } + } + } +} diff --git a/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/MaskPropertyEditor.cs b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/MaskPropertyEditor.cs new file mode 100644 index 00000000000..020b2ced46e --- /dev/null +++ b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/MaskPropertyEditor.cs @@ -0,0 +1,91 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.ComponentModel.Design; +using System.Diagnostics; +using System.Drawing.Design; + +namespace System.Windows.Forms.Design +{ + /// + /// Design time editing class for the Mask property of the MaskedTextBox control. + /// + internal class MaskPropertyEditor : UITypeEditor + { + /// + /// Gets the mask property value fromt the MaskDesignerDialog. + /// The IUIService is used to show the mask designer dialog within VS so it doesn't get blocked if focus + /// is moved to anoter app. + /// + internal static string EditMask(ITypeDiscoveryService discoverySvc, IUIService uiSvc, MaskedTextBox instance, IHelpService helpService) + { + Debug.Assert(instance != null, "Null masked text box."); + string mask = null; + + // Launching modal dialog in System aware mode. + MaskDesignerDialog dlg = DpiHelper.CreateInstanceInSystemAwareContext(() => new MaskDesignerDialog(instance, helpService)); + try + { + dlg.DiscoverMaskDescriptors(discoverySvc); // fine if service is null. + + // Show dialog from VS. + // Debug.Assert( uiSvc != null, "Expected IUIService, defaulting to an intrusive way to show the dialog..." ); + DialogResult dlgResult = uiSvc != null ? uiSvc.ShowDialog(dlg) : dlg.ShowDialog(); + if (dlgResult == DialogResult.OK) + { + mask = dlg.Mask; + + // ValidatingType is not browsable so we don't need to set the property through the designer. + if (dlg.ValidatingType != instance.ValidatingType) + { + instance.ValidatingType = dlg.ValidatingType; + } + } + } + finally + { + dlg.Dispose(); + } + + // Will return null if dlgResult != OK. + return mask; + } + + /// + /// Edits the Mask property of the MaskedTextBox control from the PropertyGrid. + /// + public override object EditValue(System.ComponentModel.ITypeDescriptorContext context, IServiceProvider provider, object value) + { + if (context == null || provider == null) + { + return value; + } + + ITypeDiscoveryService discoverySvc = (ITypeDiscoveryService)provider.GetService(typeof(ITypeDiscoveryService)); // fine if service is not found. + IUIService uiSvc = (IUIService)provider.GetService(typeof(IUIService)); + IHelpService helpService = (IHelpService)provider.GetService(typeof(IHelpService)); + string mask = MaskPropertyEditor.EditMask(discoverySvc, uiSvc, context.Instance as MaskedTextBox, helpService); + + if (mask != null) + { + return mask; + } + + return value; + } + + /// + /// Painting a representation of the Mask value is not supported. + /// + public override bool GetPaintValueSupported(System.ComponentModel.ITypeDescriptorContext context) + => false; + + /// + /// Gets the edit style of the type editor. + /// + public override UITypeEditorEditStyle GetEditStyle(System.ComponentModel.ITypeDescriptorContext context) + => UITypeEditorEditStyle.Modal; + + } +} diff --git a/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/MaskedTextBoxDesigner.cs b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/MaskedTextBoxDesigner.cs new file mode 100644 index 00000000000..e688682085f --- /dev/null +++ b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/MaskedTextBoxDesigner.cs @@ -0,0 +1,300 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Collections; +using System.ComponentModel; +using System.ComponentModel.Design; +using System.Diagnostics; +using System.Globalization; + +namespace System.Windows.Forms.Design +{ + /// + /// Designer class for the MaskedTextBox control. + /// + internal class MaskedTextBoxDesigner : TextBoxBaseDesigner + { + private DesignerVerbCollection _verbs; + private DesignerActionListCollection _actions; + + /// + /// MaskedTextBox designer action list property. Gets the design-time supported actions on the control. + /// + public override DesignerActionListCollection ActionLists + { + get + { + if (_actions == null) + { + _actions = new DesignerActionListCollection(); + _actions.Add(new MaskedTextBoxDesignerActionList(this)); + } + + return _actions; + } + } + + /// + /// A utility method to get a design time masked text box based on the masked text box being designed. + /// + /// The masked text box. + /// + internal static MaskedTextBox GetDesignMaskedTextBox(MaskedTextBox maskedTextBox) + { + MaskedTextBox designMaskedTextBox; + if (maskedTextBox == null) + { + // return a default control. + designMaskedTextBox = new MaskedTextBox(); + } + else + { + MaskedTextProvider maskedTextProvider = maskedTextBox.MaskedTextProvider; + + if (maskedTextProvider == null) + { + designMaskedTextBox = new MaskedTextBox(); + designMaskedTextBox.Text = maskedTextBox.Text; + } + else + { + designMaskedTextBox = new MaskedTextBox(maskedTextBox.MaskedTextProvider); + } + + // Clone MTB properties. + designMaskedTextBox.ValidatingType = maskedTextBox.ValidatingType; + designMaskedTextBox.BeepOnError = maskedTextBox.BeepOnError; + designMaskedTextBox.InsertKeyMode = maskedTextBox.InsertKeyMode; + designMaskedTextBox.RejectInputOnFirstFailure = maskedTextBox.RejectInputOnFirstFailure; + designMaskedTextBox.CutCopyMaskFormat = maskedTextBox.CutCopyMaskFormat; + designMaskedTextBox.Culture = maskedTextBox.Culture; + // designMaskedTextBox.TextMaskFormat = maskedTextBox.TextMaskFormat; - Not relevant since it is to be used programatically only. + } + + // Some constant properties at design time. + designMaskedTextBox.UseSystemPasswordChar = false; + designMaskedTextBox.PasswordChar = '\0'; + designMaskedTextBox.ReadOnly = false; + designMaskedTextBox.HidePromptOnLeave = false; + + return designMaskedTextBox; + } + + internal static string GetMaskInputRejectedErrorMessage(MaskInputRejectedEventArgs e) + { + string rejectionHint; + + switch (e.RejectionHint) + { + case MaskedTextResultHint.AsciiCharacterExpected: + rejectionHint = SR.MaskedTextBoxHintAsciiCharacterExpected; + break; + case MaskedTextResultHint.AlphanumericCharacterExpected: + rejectionHint = SR.MaskedTextBoxHintAlphanumericCharacterExpected; + break; + case MaskedTextResultHint.DigitExpected: + rejectionHint = SR.MaskedTextBoxHintDigitExpected; + break; + case MaskedTextResultHint.LetterExpected: + rejectionHint = SR.MaskedTextBoxHintLetterExpected; + break; + case MaskedTextResultHint.SignedDigitExpected: + rejectionHint = SR.MaskedTextBoxHintSignedDigitExpected; + break; + case MaskedTextResultHint.PromptCharNotAllowed: + rejectionHint = SR.MaskedTextBoxHintPromptCharNotAllowed; + break; + case MaskedTextResultHint.UnavailableEditPosition: + rejectionHint = SR.MaskedTextBoxHintUnavailableEditPosition; + break; + case MaskedTextResultHint.NonEditPosition: + rejectionHint = SR.MaskedTextBoxHintNonEditPosition; + break; + case MaskedTextResultHint.PositionOutOfRange: + rejectionHint = SR.MaskedTextBoxHintPositionOutOfRange; + break; + case MaskedTextResultHint.InvalidInput: + rejectionHint = SR.MaskedTextBoxHintInvalidInput; + break; + case MaskedTextResultHint.Unknown: + default: + Debug.Fail("Unknown RejectionHint, defaulting to InvalidInput..."); + goto case MaskedTextResultHint.InvalidInput; + + } + + return string.Format(CultureInfo.CurrentCulture, SR.MaskedTextBoxTextEditorErrorFormatString, e.Position, rejectionHint); + } + + /// + /// Obsolete ComponentDesigner method which sets component default properties. Overriden to avoid setting + /// the Mask improperly. + /// + [Obsolete("This method has been deprecated. Use InitializeNewComponent instead. http://go.microsoft.com/fwlink/?linkid=14202")] + public override void OnSetComponentDefaults() + { + // do nothing. + } + + /// + /// Event handler for the set mask verb. + /// + private void OnVerbSetMask(object sender, EventArgs e) + { + MaskedTextBoxDesignerActionList actionList = new MaskedTextBoxDesignerActionList(this); + actionList.SetMask(); + } + + /// + /// Allows a designer to filter the set of properties + /// the component it is designing will expose through the + /// TypeDescriptor object. This method is called + /// immediately before its corresponding "Post" method. + /// If you are overriding this method you should call + /// the base implementation before you perform your own + /// filtering. + /// + protected override void PreFilterProperties(IDictionary properties) + { + base.PreFilterProperties(properties); + + PropertyDescriptor prop; + + string[] shadowProps = new string[] + { + "Text", + "PasswordChar" + }; + + Attribute[] empty = new Attribute[0]; + + for (int i = 0; i < shadowProps.Length; i++) + { + prop = (PropertyDescriptor)properties[shadowProps[i]]; + if (prop != null) + { + properties[shadowProps[i]] = TypeDescriptor.CreateProperty(typeof(MaskedTextBoxDesigner), prop, empty); + } + } + } + + /// + /// Retrieves a set of rules concerning the movement capabilities of a component. + /// This should be one or more flags from the SelectionRules class. If no designer + /// provides rules for a component, the component will not get any UI services. + /// + public override SelectionRules SelectionRules + { + get + { + SelectionRules rules = base.SelectionRules; + rules &= ~(SelectionRules.TopSizeable | SelectionRules.BottomSizeable); // Height is fixed. + return rules; + } + } + + /// + /// Shadows the PasswordChar. UseSystemPasswordChar overrides PasswordChar so independent on the value + /// of PasswordChar it will return the systemp password char. However, the value of PasswordChar is + /// cached so if UseSystemPasswordChar is reset at design time the PasswordChar value can be restored. + /// So in the case both properties are set, we need to serialize the real PasswordChar value as well. + /// + private char PasswordChar + { + get + { + MaskedTextBox maskedTextBox = Control as MaskedTextBox; + Debug.Assert(maskedTextBox != null, "Designed control is not a MaskedTextBox."); + + if (maskedTextBox.UseSystemPasswordChar) + { + maskedTextBox.UseSystemPasswordChar = false; + char pwdChar = maskedTextBox.PasswordChar; + maskedTextBox.UseSystemPasswordChar = true; + + return pwdChar; + } + else + { + return maskedTextBox.PasswordChar; + } + } + set + { + MaskedTextBox maskedTextBox = Control as MaskedTextBox; + Debug.Assert(maskedTextBox != null, "Designed control is not a MaskedTextBox."); + + maskedTextBox.PasswordChar = value; + } + } + + /// + /// Shadow the Text property to do two things: + /// 1. Always show the text without prompt or literals. + /// 2. The text from the UITypeEditor is assigned escaping literals, prompt and spaces, this is to allow for partial inputs. + /// Observe that if the MTB is hooked to a PropertyBrowser at design time, shadowing of the property won't work unless the + /// application is a well written control designer (implements corresponding interfaces). + /// + private string Text + { + get + { + // Return text w/o literals or prompt. + MaskedTextBox maskedTextBox = Control as MaskedTextBox; + Debug.Assert(maskedTextBox != null, "Designed control is not a MaskedTextBox."); + + // Text w/o prompt or literals. + if (string.IsNullOrEmpty(maskedTextBox.Mask)) + { + return maskedTextBox.Text; + } + return maskedTextBox.MaskedTextProvider.ToString(false, false); + } + set + { + MaskedTextBox maskedTextBox = Control as MaskedTextBox; + Debug.Assert(maskedTextBox != null, "Designed control is not a MaskedTextBox."); + + if (string.IsNullOrEmpty(maskedTextBox.Mask)) + { + maskedTextBox.Text = value; + } + else + { + bool ResetOnSpace = maskedTextBox.ResetOnSpace; + bool ResetOnPrompt = maskedTextBox.ResetOnPrompt; + bool SkipLiterals = maskedTextBox.SkipLiterals; + + maskedTextBox.ResetOnSpace = true; + maskedTextBox.ResetOnPrompt = true; + maskedTextBox.SkipLiterals = true; + + // Value is expected to contain literals and prompt. + maskedTextBox.Text = value; + + maskedTextBox.ResetOnSpace = ResetOnSpace; + maskedTextBox.ResetOnPrompt = ResetOnPrompt; + maskedTextBox.SkipLiterals = SkipLiterals; + } + } + } + + /// + /// MaskedTextBox designer verb collection property. Gets the design-time supported verbs of the control. + /// + public override DesignerVerbCollection Verbs + { + get + { + if (_verbs == null) + { + _verbs = new DesignerVerbCollection(); + _verbs.Add(new DesignerVerb(SR.MaskedTextBoxDesignerVerbsSetMaskDesc, new EventHandler(OnVerbSetMask))); + } + + return _verbs; + } + } + } +} diff --git a/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/MaskedTextBoxDesignerActionList.cs b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/MaskedTextBoxDesignerActionList.cs new file mode 100644 index 00000000000..ad0ac5a79ac --- /dev/null +++ b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/MaskedTextBoxDesignerActionList.cs @@ -0,0 +1,66 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.ComponentModel; +using System.ComponentModel.Design; +using System.Diagnostics; + +namespace System.Windows.Forms.Design +{ + /// + /// Describes the list of actions that can be performed in the MaskedTextBox control from the + /// Chrome pannel. + /// + internal class MaskedTextBoxDesignerActionList : DesignerActionList + { + private readonly MaskedTextBox _maskedTextBox; + private readonly ITypeDiscoveryService _discoverySvc; + private readonly IUIService _uiSvc; + private readonly 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) + { + _maskedTextBox = (MaskedTextBox)designer.Component; + _discoverySvc = GetService(typeof(ITypeDiscoveryService)) as ITypeDiscoveryService; + _uiSvc = GetService(typeof(IUIService)) as IUIService; + _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(_discoverySvc, _uiSvc, _maskedTextBox, _helpService); + + if (mask == null) + { + return; + } + + PropertyDescriptor maskProperty = TypeDescriptor.GetProperties(_maskedTextBox)["Mask"]; + maskProperty?.SetValue(_maskedTextBox, mask); + } + + /// + /// Returns the control's action list items. + /// + public override DesignerActionItemCollection GetSortedActionItems() + { + DesignerActionItemCollection items = new DesignerActionItemCollection(); + items.Add(new DesignerActionMethodItem(this, "SetMask", SR.MaskedTextBoxDesignerVerbsSetMaskDesc)); + return items; + } + } +} diff --git a/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/MaskedTextBoxTextEditor.cs b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/MaskedTextBoxTextEditor.cs new file mode 100644 index 00000000000..8c8f7300b5e --- /dev/null +++ b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/MaskedTextBoxTextEditor.cs @@ -0,0 +1,64 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.ComponentModel; +using System.Drawing.Design; + +namespace System.Windows.Forms.Design +{ + internal class MaskedTextBoxTextEditor : UITypeEditor + { + public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) + { + if (context?.Instance == null || provider == null) + { + return value; + } + + if (!(provider.GetService(typeof(IWindowsFormsEditorService)) is IWindowsFormsEditorService editorService)) + { + return value; + } + + MaskedTextBox maskedTextBox = context.Instance as MaskedTextBox; + if (maskedTextBox == null) + { + maskedTextBox = new MaskedTextBox(); + maskedTextBox.Text = value as string; + } + + MaskedTextBoxTextEditorDropDown dropDown = new MaskedTextBoxTextEditorDropDown(maskedTextBox); + editorService.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 => false; + } +} diff --git a/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/MaskedTextBoxTextEditorDropDown.cs b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/MaskedTextBoxTextEditorDropDown.cs new file mode 100644 index 00000000000..d4a2c49b1ea --- /dev/null +++ b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/MaskedTextBoxTextEditorDropDown.cs @@ -0,0 +1,94 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace System.Windows.Forms.Design +{ + internal class MaskedTextBoxTextEditorDropDown : UserControl + { + private bool _cancel; + private readonly MaskedTextBox _cloneMtb; + private readonly ErrorProvider _errorProvider; + + public MaskedTextBoxTextEditorDropDown(MaskedTextBox maskedTextBox) + { + _cloneMtb = MaskedTextBoxDesigner.GetDesignMaskedTextBox(maskedTextBox); + _errorProvider = new ErrorProvider(); + ((System.ComponentModel.ISupportInitialize)(_errorProvider)).BeginInit(); + + SuspendLayout(); + // + // maskedTextBox + // + _cloneMtb.Dock = DockStyle.Fill; + + // Include prompt and literals always so editor can process the text value in a consistent way. + _cloneMtb.TextMaskFormat = MaskFormat.IncludePromptAndLiterals; + + // Escape prompt, literals and space so input is not rejected due to one of these characters. + _cloneMtb.ResetOnPrompt = true; + _cloneMtb.SkipLiterals = true; + _cloneMtb.ResetOnSpace = true; + + _cloneMtb.Name = "MaskedTextBoxClone"; + _cloneMtb.TabIndex = 0; + _cloneMtb.MaskInputRejected += new MaskInputRejectedEventHandler(maskedTextBox_MaskInputRejected); + _cloneMtb.KeyDown += new KeyEventHandler(maskedTextBox_KeyDown); + + // + // errorProvider + // + _errorProvider.BlinkStyle = ErrorBlinkStyle.NeverBlink; + _errorProvider.ContainerControl = this; + + // + // MaskedTextBoxTextEditorDropDown + // + Controls.Add(_cloneMtb); + + BackColor = System.Drawing.SystemColors.Control; + BorderStyle = BorderStyle.FixedSingle; + Name = "MaskedTextBoxTextEditorDropDown"; + Padding = new Padding(16); + Size = new System.Drawing.Size(100, 52); + ((System.ComponentModel.ISupportInitialize)(_errorProvider)).EndInit(); + ResumeLayout(false); + PerformLayout(); + } + + public string Value + { + get + { + if (_cancel) + { + return null; + } + + // Output will include prompt and literals always to be able to get the characters at the right positions in case + // some of them are not set (particularly at lower positions). + return _cloneMtb.Text; + } + } + + protected override bool ProcessDialogKey(Keys keyData) + { + if (keyData == Keys.Escape) + { + _cancel = true; + } + + return base.ProcessDialogKey(keyData); + } + + private void maskedTextBox_MaskInputRejected(object sender, MaskInputRejectedEventArgs e) + { + _errorProvider.SetError(_cloneMtb, MaskedTextBoxDesigner.GetMaskInputRejectedErrorMessage(e)); + } + + private void maskedTextBox_KeyDown(object sender, KeyEventArgs e) + { + _errorProvider.Clear(); + } + } +} diff --git a/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/TextBoxBaseDesigner.cs b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/TextBoxBaseDesigner.cs new file mode 100644 index 00000000000..a576137bbde --- /dev/null +++ b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/TextBoxBaseDesigner.cs @@ -0,0 +1,170 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace System.Windows.Forms.Design +{ + using System; + using System.Collections; + using System.ComponentModel; + using System.Diagnostics; + using System.Windows.Forms.Design.Behavior; + + /// + /// Provides a designer that can design components + /// that extend TextBoxBase. + /// + internal class TextBoxBaseDesigner : ControlDesigner + { + public TextBoxBaseDesigner() + { + AutoResizeHandles = true; + } + + /// + /// Adds a baseline SnapLine to the list of SnapLines related + /// to this control. + /// + public override IList SnapLines + { + get + { + ArrayList snapLines = base.SnapLines as ArrayList; + + int baseline = DesignerUtils.GetTextBaseline(Control, System.Drawing.ContentAlignment.TopLeft); + + BorderStyle borderStyle = BorderStyle.Fixed3D; + PropertyDescriptor prop = TypeDescriptor.GetProperties(Component)["BorderStyle"]; + if (prop != null) + { + borderStyle = (BorderStyle)prop.GetValue(Component); + } + + if (borderStyle == BorderStyle.None) + { + baseline += 0; + } + else if (borderStyle == BorderStyle.FixedSingle) + { + baseline += 2; + } + else if (borderStyle == BorderStyle.Fixed3D) + { + baseline += 3; + } + else + { + Debug.Fail("Unknown borderstyle"); + baseline += 0; + } + + snapLines.Add(new SnapLine(SnapLineType.Baseline, baseline, SnapLinePriority.Medium)); + + return snapLines; + } + } + + private string Text + { + get + { + return Control.Text; + } + set + { + Control.Text = value; + + // This fixes bug #48462. If the text box is not wide enough to display all of the text, + // then we want to display the first portion at design-time. We can ensure this by + // setting the selection to (0, 0). + // + ((TextBoxBase)Control).Select(0, 0); + } + } + + private bool ShouldSerializeText() + { + return TypeDescriptor.GetProperties(typeof(TextBoxBase))["Text"].ShouldSerializeValue(Component); + } + + private void ResetText() + { + Control.Text = ""; + } + + /// + /// We override this so we can clear the text field set by controldesigner. + /// + /// The default values. + public override void InitializeNewComponent(IDictionary defaultValues) + { + base.InitializeNewComponent(defaultValues); + + PropertyDescriptor textProp = TypeDescriptor.GetProperties(Component)["Text"]; + if (textProp != null && textProp.PropertyType == typeof(string) && !textProp.IsReadOnly && textProp.IsBrowsable) + { + textProp.SetValue(Component, ""); + } + } + + protected override void PreFilterProperties(IDictionary properties) + { + base.PreFilterProperties(properties); + + PropertyDescriptor prop; + + // Handle shadowed properties + // + string[] shadowProps = new string[] { + "Text", + }; + + Attribute[] empty = new Attribute[0]; + + for (int i = 0; i < shadowProps.Length; i++) + { + prop = (PropertyDescriptor)properties[shadowProps[i]]; + if (prop != null) + { + properties[shadowProps[i]] = TypeDescriptor.CreateProperty(typeof(TextBoxBaseDesigner), prop, empty); + } + } + } + + /// + /// Retrieves a set of rules concerning the movement capabilities of a component. + /// This should be one or more flags from the SelectionRules class. If no designer + /// provides rules for a component, the component will not get any UI services. + /// + public override SelectionRules SelectionRules + { + get + { + SelectionRules rules = base.SelectionRules; + object component = Component; + + rules |= SelectionRules.AllSizeable; + + PropertyDescriptor prop = TypeDescriptor.GetProperties(component)["Multiline"]; + if (prop != null) + { + Object value = prop.GetValue(component); + if (value is bool && (bool)value == false) + { + PropertyDescriptor propAuto = TypeDescriptor.GetProperties(component)["AutoSize"]; + if (propAuto != null) + { + Object auto = propAuto.GetValue(component); + if (auto is bool && (bool)auto == true) + { + rules &= ~(SelectionRules.TopSizeable | SelectionRules.BottomSizeable); + } + } + } + } + + return rules; + } + } + } +}