当前位置: 首页>>代码示例>>C#>>正文


C# MaskedTextProvider.ToString方法代码示例

本文整理汇总了C#中System.ComponentModel.MaskedTextProvider.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# MaskedTextProvider.ToString方法的具体用法?C# MaskedTextProvider.ToString怎么用?C# MaskedTextProvider.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.ComponentModel.MaskedTextProvider的用法示例。


在下文中一共展示了MaskedTextProvider.ToString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Formatar

        public static string Formatar(string valor, string mascara)
        {
            MaskedTextProvider mtpCnpj = new MaskedTextProvider(mascara);
            mtpCnpj.Set(valor);
            var formatted = mtpCnpj.ToString();
            if (formatted.IndexOf(" ") == -1) return formatted;

            mascara = mascara.Replace("0", "#").Replace(@"\", "");

            StringBuilder dado = new StringBuilder();
            foreach (char c in valor)
            {
                if (Char.IsNumber(c) || c == 'x' || c == 'X')
                    dado.Append(c);
            }

            int indMascara = mascara.Length;
            int indCampo = dado.Length;
            for (; indCampo > 0 && indMascara > 0; )
            {
                if (mascara[--indMascara] == '#')
                    indCampo -= 1;
            }

            StringBuilder saida = new StringBuilder();
            for (; indMascara < mascara.Length; indMascara++)
            {
                saida.Append((mascara[indMascara] == '#') ? dado[indCampo++] : mascara[indMascara]);
            }

            return saida.ToString();
        }
开发者ID:Didox,项目名称:MVC_e_Velocit_app,代码行数:32,代码来源:Funcoes.cs

示例2: PasswordTest

		public void PasswordTest ()
		{

			MaskedTextProvider mtp = new MaskedTextProvider ("abcd", CultureInfo.GetCultureInfo ("es-AR"), false, '>', '^', false); 
			Assert.AreEqual (" bcd", mtp.ToString (), "#A1");
			
		}
开发者ID:peterdocter,项目名称:mono,代码行数:7,代码来源:MaskedTextProviderTest.cs

示例3: FormatCNPJ

 /// <summary>
 /// formata o CNPJ
 /// </summary>
 /// <param name="cnpj">valor a ser formatado</param>
 /// <returns></returns>
 public static string FormatCNPJ(string cnpj)
 {
     string ret = "";
     MaskedTextProvider mascara;
     cnpj = Functions.OnlyNumbers(cnpj, "-.,/").ToString();
     //cnpj
     //##.###.###/####-##
     mascara = new MaskedTextProvider(@"00\.000\.000/0000-00");
     mascara.Set(cnpj);
     ret = mascara.ToString();
     return ret;
 }
开发者ID:akretion,项目名称:uninfe,代码行数:17,代码来源:CNPJ.cs

示例4: GetFormattedString

        private string GetFormattedString( MaskedTextProvider provider )
        {
            System.Diagnostics.Debug.Assert( provider.EditPositionCount > 0 );

              bool includePrompt = ( this.IsReadOnly ) ? false : ( !this.HidePromptOnLeave || this.IsFocused );

              string displayString = provider.ToString( false, includePrompt, true, 0, m_maskedTextProvider.Length );

              return displayString;
        }
开发者ID:eolandezhang,项目名称:Diagram,代码行数:10,代码来源:MaskedTextBox.cs

示例5: AssertProperties

		/* START */
		public static void AssertProperties (MaskedTextProvider mtp, string test_name, int counter, bool allow_prompt, bool ascii_only, int assigned_edit_position_count, int available_edit_position_count,
				CultureInfo culture, int edit_position_count, bool include_literals, bool include_prompt, bool is_password, int last_assigned_position,
				int length, string mask, bool mask_completed, bool mask_full, char password_char, char prompt_char, bool reset_on_prompt, bool reset_on_space, bool skip_literals,
				string tostring, string tostring_true, string tostring_false, string tostring_true_true, string tostring_true_false, string tostring_false_true, string tostring_false_false)
		{
			// Testing all properties...
			//return;
			int i = 1;
			ArrayList asserts = new ArrayList ();
			try {
				Assert.AreEqual (allow_prompt, mtp.AllowPromptAsInput, string.Format ("{0}-#{1} (AllowPromptAsInput)", test_name + counter.ToString (), (i++).ToString ()));
			} catch (AssertionException ex) {
				asserts.Add (ex);
			}
			try {
				Assert.AreEqual (ascii_only, mtp.AsciiOnly, string.Format ("{0}-#{1} (AsciiOnly)", test_name + counter.ToString (), (i++).ToString ()));
			} catch (AssertionException ex) {
				asserts.Add (ex);
			}
			try {
				Assert.AreEqual (assigned_edit_position_count, mtp.AssignedEditPositionCount, string.Format ("{0}-#{1} (AssignedEditPositionCount)", test_name + counter.ToString (), (i++).ToString ()));
			} catch (AssertionException ex) {
				asserts.Add (ex);
			}
			try {
				Assert.AreEqual (available_edit_position_count, mtp.AvailableEditPositionCount, string.Format ("{0}-#{1} (AvailableEditPositionCount)", test_name + counter.ToString (), (i++).ToString ()));
			} catch (AssertionException ex) {
				asserts.Add (ex);
			}
			try {
				//Assert.AreEqual (culture, mtp.Culture, string.Format ("{0}-#{1} (Culture)", test_name + counter.ToString (), (i++).ToString ()));
			} catch (AssertionException ex) {
				asserts.Add (ex);
			}
			try {
				Assert.AreEqual (edit_position_count, mtp.EditPositionCount, string.Format ("{0}-#{1} (EditPositionCount)", test_name + counter.ToString (), (i++).ToString ()));
			} catch (AssertionException ex) {
				asserts.Add (ex);
			}
			try {
				//Assert.AreEqual ({0}, mtp.EditPositions,string.Format( "{0}-#{1} (EditPositions)", test_name + counter.ToString (), (i++).ToString ()));
			} catch (AssertionException ex) {
				asserts.Add (ex);
			}
			try {
				Assert.AreEqual (include_literals, mtp.IncludeLiterals, string.Format ("{0}-#{1} (IncludeLiterals)", test_name + counter.ToString (), (i++).ToString ()));
			} catch (AssertionException ex) {
				asserts.Add (ex);
			}
			try {
				Assert.AreEqual (include_prompt, mtp.IncludePrompt, string.Format ("{0}-#{1} (IncludePrompt)", test_name + counter.ToString (), (i++).ToString ()));
			} catch (AssertionException ex) {
				asserts.Add (ex);
			}
			try {
				Assert.AreEqual (is_password, mtp.IsPassword, string.Format ("{0}-#{1} (IsPassword)", test_name + counter.ToString (), (i++).ToString ()));
			} catch (AssertionException ex) {
				asserts.Add (ex);
			}
			try {
				Assert.AreEqual (last_assigned_position, mtp.LastAssignedPosition, string.Format ("{0}-#{1} (LastAssignedPosition)", test_name + counter.ToString (), (i++).ToString ()));
			} catch (AssertionException ex) {
				asserts.Add (ex);
			}
			try {
				Assert.AreEqual (length, mtp.Length, string.Format ("{0}-#{1} (Length)", test_name + counter.ToString (), (i++).ToString ()));
			} catch (AssertionException ex) {
				asserts.Add (ex);
			}
			try {
				Assert.AreEqual (mask, mtp.Mask, string.Format ("{0}-#{1} (Mask)", test_name + counter.ToString (), (i++).ToString ()));
			} catch (AssertionException ex) {
				asserts.Add (ex);
			}
			try {
				Assert.AreEqual (mask_completed, mtp.MaskCompleted, string.Format ("{0}-#{1} (MaskCompleted)", test_name + counter.ToString (), (i++).ToString ()));
			} catch (AssertionException ex) {
				asserts.Add (ex);
			}
			try {
				Assert.AreEqual (mask_full, mtp.MaskFull, string.Format ("{0}-#{1} (MaskFull)", test_name + counter.ToString (), (i++).ToString ()));
			} catch (AssertionException ex) {
				asserts.Add (ex);
			}
			try {
				Assert.AreEqual (password_char, mtp.PasswordChar, string.Format ("{0}-#{1} (PasswordChar)", test_name + counter.ToString (), (i++).ToString ()));
			} catch (AssertionException ex) {
				asserts.Add (ex);
			}
			try {
				Assert.AreEqual (prompt_char, mtp.PromptChar, string.Format ("{0}-#{1} (PromptChar)", test_name + counter.ToString (), (i++).ToString ()));
			} catch (AssertionException ex) {
				asserts.Add (ex);
			}
			try {
				Assert.AreEqual (reset_on_prompt, mtp.ResetOnPrompt, string.Format ("{0}-#{1} (ResetOnPrompt)", test_name + counter.ToString (), (i++).ToString ()));
			} catch (AssertionException ex) {
				asserts.Add (ex);
			}
//.........这里部分代码省略.........
开发者ID:peterdocter,项目名称:mono,代码行数:101,代码来源:MaskedTextProviderTest.cs

示例6: ToString_bool_bool_int_int_Test00008

		public void ToString_bool_bool_int_int_Test00008 ()
		{
			MaskedTextProvider mtp;
			//int Int32_out = 0;
			//MaskedTextResultHint MaskedTextResultHint_out = MaskedTextResultHint.Unknown;
			mtp = new MaskedTextProvider (@"abc");
			mtp.Add (@"a");
			mtp.Remove ();
			mtp.InsertAt ('\x61', 1);
			Assert.AreEqual (@"_", mtp.ToString (true, true, -1, 1), "#0");
			MaskedTextProviderTest.AssertProperties (mtp, "ToString_bool_bool_int_int_Test", 1, true, false, 0, 1, CultureInfo.GetCultureInfo ("es-ES"), 1, true, false, false, -1, 3, @"abc", true, false, '\x0', '\x5F', true, true, true, @" bc", @" bc", @" bc", @"_bc", @"_", @" bc", @"");
		}
开发者ID:peterdocter,项目名称:mono,代码行数:12,代码来源:MaskedTextProviderTest.cs

示例7: ToString_bool_bool_bool_int_int_Test00055

		public void ToString_bool_bool_bool_int_int_Test00055 ()
		{
			MaskedTextProvider mtp;
			int Int32_out = 0;
			MaskedTextResultHint MaskedTextResultHint_out = MaskedTextResultHint.Unknown;
			mtp = new MaskedTextProvider (@"abc");
			mtp.Add (@"a");
			mtp.Add ('\x61');
			mtp.Add ('\x61', out Int32_out, out MaskedTextResultHint_out);
			Assert.AreEqual (@"c", mtp.ToString (true, true, true, 2, 2), "#6");
			MaskedTextProviderTest.AssertProperties (mtp, "ToString_bool_bool_bool_int_int_Test", 7, true, false, 1, 0, CultureInfo.GetCultureInfo ("es-ES"), 1, true, false, false, 0, 3, @"abc", true, true, '\x0', '\x5F', true, true, true, @"abc", @"abc", @"abc", @"abc", @"a", @"abc", @"a");
		}
开发者ID:peterdocter,项目名称:mono,代码行数:12,代码来源:MaskedTextProviderTest.cs

示例8: ToString_False_FalseTest

		public void ToString_False_FalseTest ()
		{
			MaskedTextProvider mtp;

			mtp = new MaskedTextProvider ("a?a");
			Assert.AreEqual ("", mtp.ToString (false, false), "#01");
			mtp.InsertAt ('a', 1);
			Assert.AreEqual (" a", mtp.ToString (false, false), "#02");

			mtp = new MaskedTextProvider ("a?a");
			Assert.AreEqual ("", mtp.ToString (false, false), "#03");
			mtp.InsertAt ('a', 0);
			Assert.AreEqual ("a", mtp.ToString (false, false), "#04");

			mtp = new MaskedTextProvider ("a?a?a");
			Assert.AreEqual ("", mtp.ToString (false, false), "#05");
			mtp.InsertAt ('a', 3);
			Assert.AreEqual ("   a", mtp.ToString (false, false), "#06");

			mtp = new MaskedTextProvider ("????a");
			Assert.AreEqual ("", mtp.ToString (false, false), "#07");
			mtp.InsertAt ('a', 3);
			Assert.AreEqual ("   a", mtp.ToString (false, false), "#08");

			mtp = new MaskedTextProvider ("LLLLa");
			Assert.AreEqual ("", mtp.ToString (false, false), "#09");
			mtp.InsertAt ('a', 3);
			Assert.AreEqual ("   a", mtp.ToString (false, false), "#10");

			mtp = new MaskedTextProvider ("CCCCa");
			Assert.AreEqual ("", mtp.ToString (false, false), "#11");
			mtp.InsertAt ('a', 3);
			Assert.AreEqual ("   a", mtp.ToString (false, false), "#12");

			mtp = new MaskedTextProvider ("aaaaa");
			Assert.AreEqual ("", mtp.ToString (false, false), "#13");
			mtp.InsertAt ('a', 3);
			Assert.AreEqual ("   a", mtp.ToString (false, false), "#14");

			mtp = new MaskedTextProvider ("aaaaaaaaaaaaaaaaaaaaaa");
			Assert.AreEqual ("", mtp.ToString (false, false), "#15");
			mtp.InsertAt ('a', 3);
			Assert.AreEqual ("   a", mtp.ToString (false, false), "#16");
			mtp.InsertAt ('a', 9);
			Assert.AreEqual ("   a     a", mtp.ToString (false, false), "#17");

			mtp = new MaskedTextProvider ("aaa");
			mtp.PasswordChar = '*';
			mtp.InsertAt ('a', 2);
			Assert.AreEqual ("  a", mtp.ToString (false, false), "#18");
		}
开发者ID:peterdocter,项目名称:mono,代码行数:51,代码来源:MaskedTextProviderTest.cs

示例9: ToString_PasswordTest

		public void ToString_PasswordTest ()
		{
			MaskedTextProvider mtp;

			mtp = new MaskedTextProvider ("####");
			mtp.PasswordChar = '*';
			Assert.AreEqual ("____", mtp.ToString (true, true, true, 0, mtp.Length), "#A1");
			Assert.AreEqual ("____", mtp.ToString (false, true, true, 0, mtp.Length), "#A2");

			mtp.Add ("314");
			Assert.AreEqual ("314_", mtp.ToString (true, true, true, 0, mtp.Length), "#B1");
			Assert.AreEqual ("***_", mtp.ToString (false, true, true, 0, mtp.Length), "#B2");

			mtp.Clear ();

			mtp.InsertAt ("666", 1);
			Assert.AreEqual ("_666", mtp.ToString (true, true, true, 0, mtp.Length), "#C1");
			Assert.AreEqual ("_***", mtp.ToString (false, true, true, 0, mtp.Length), "#C2");
		}
开发者ID:peterdocter,项目名称:mono,代码行数:19,代码来源:MaskedTextProviderTest.cs

示例10: Convert

    public object Convert( object value, Type targetType, object parameter, CultureInfo culture )
    {
      if( !targetType.IsAssignableFrom( typeof( string ) ) )
        return DependencyProperty.UnsetValue;

      string workingText = ( value == null ) ? string.Empty : value.ToString();

      string mask = null; // Defaults to no mask when no parameter is specified.

      if( parameter != null )
      {
        Type parameterType = parameter.GetType();
        if( parameterType == typeof( string ) )
        {
          string stringParameter = ( string )parameter;

          if( !string.IsNullOrEmpty( stringParameter ) )
            mask = stringParameter;
        }
        else
        {
          return DependencyProperty.UnsetValue;
        }
      }

      if( !string.IsNullOrEmpty( mask ) )
      {
        try
        {
          string rawText = string.Empty;

          CultureInfo currentCulture = CultureInfo.CurrentCulture;

          if( value != null )
          {
            try
            {
              Type valueDataType = value.GetType();

              MethodInfo valueToStringMethodInfo =
                valueDataType.GetMethod( "ToString", new Type[] { typeof( string ), typeof( IFormatProvider ) } );

              string formatSpecifier = MaskedTextBox.GetFormatSpecifierFromMask( mask, currentCulture );

              if( valueToStringMethodInfo != null )
              {
                rawText = ( string )valueToStringMethodInfo.Invoke( value, new object[] { formatSpecifier, currentCulture } );
              }
              else
              {
                rawText = value.ToString();
              }
            }
            catch
            {
              rawText = value.ToString();
            }
          }

          MaskedTextProvider maskedTextProvider = new MaskedTextProvider( mask, currentCulture );

          maskedTextProvider.Set( rawText );

          return maskedTextProvider.ToString( false, true );
        }
        catch
        {
        }
      }

      return value.ToString();
    }
开发者ID:wangws556,项目名称:duoduo-chat,代码行数:72,代码来源:ValueToMaskedTextConverter.cs

示例11: InsertAt_charTest

		public void InsertAt_charTest ()
		{
			MaskedTextProvider mtp;
			int Int32_out = 0;
			MaskedTextResultHint MaskedTextResultHint_out = MaskedTextResultHint.Unknown;

			// insert space over space
			mtp = new MaskedTextProvider ("aaa");
			mtp.Add (" ");
			Assert.AreEqual (true, mtp.InsertAt (' ', 0, out Int32_out, out MaskedTextResultHint_out), "#A1");
			Assert.AreEqual ("", mtp.ToString (), "A2");
			Assert.AreEqual (0, Int32_out, "A3");
			Assert.AreEqual (MaskedTextResultHint.CharacterEscaped, MaskedTextResultHint_out, "A4");
			MaskedTextProviderTest.AssertProperties (mtp, "InsertAt_charTest_A", 1, true, false, 0, 3, CultureInfo.GetCultureInfo ("es-ES"), 3, true, false, false, -1, 3, @"aaa", true, false, '\x0', '\x5F', true, true, true, @"", @"", @"", @"___", @"___", @"", @"");

			// insert space over normal char.
			mtp = new MaskedTextProvider ("aaa");
			mtp.Add ("a");
			Assert.AreEqual (true, mtp.InsertAt (' ', 0, out Int32_out, out MaskedTextResultHint_out), "#B1");
			Assert.AreEqual (" a", mtp.ToString (), "B2");
			Assert.AreEqual (0, Int32_out, "B3");
			Assert.AreEqual (MaskedTextResultHint.Success, MaskedTextResultHint_out, "B4");
			MaskedTextProviderTest.AssertProperties (mtp, "InsertAt_charTest_B", 1, true, false, 1, 2, CultureInfo.GetCultureInfo ("es-ES"), 3, true, false, false, 1, 3, @"aaa", true, false, '\x0', '\x5F', true, true, true, @" a", @" a", @" a", @"_a_", @"_a_", @" a", @" a");

			// insert space over empty position.
			mtp = new MaskedTextProvider ("aaa");
			Assert.AreEqual (true, mtp.InsertAt (' ', 0, out Int32_out, out MaskedTextResultHint_out), "#C1");
			Assert.AreEqual ("", mtp.ToString (), "C2");
			Assert.AreEqual (0, Int32_out, "C3");
			Assert.AreEqual (MaskedTextResultHint.CharacterEscaped, MaskedTextResultHint_out, "C4");
			MaskedTextProviderTest.AssertProperties (mtp, "InsertAt_charTest_C", 1, true, false, 0, 3, CultureInfo.GetCultureInfo ("es-ES"), 3, true, false, false, -1, 3, @"aaa", true, false, '\x0', '\x5F', true, true, true, @"", @"", @"", @"___", @"___", @"", @"");

			// insert space over empty position with other characters later in the string already inserted..
			mtp = new MaskedTextProvider ("aaa");
			mtp.InsertAt ('z', 2);
			Assert.AreEqual (true, mtp.InsertAt (' ', 0, out Int32_out, out MaskedTextResultHint_out), "#D1");
			Assert.AreEqual ("  z", mtp.ToString (), "D2");
			Assert.AreEqual (0, Int32_out, "D3");
			Assert.AreEqual (MaskedTextResultHint.CharacterEscaped, MaskedTextResultHint_out, "D4");
			MaskedTextProviderTest.AssertProperties (mtp, "InsertAt_charTest_D", 1, true, false, 1, 2, CultureInfo.GetCultureInfo ("es-ES"), 3, true, false, false, 2, 3, @"aaa", true, false, '\x0', '\x5F', true, true, true, @"  z", @"  z", @"  z", @"__z", @"__z", @"  z", @"  z");

			// insert space over non-empty position with other characters later in the string already inserted..
			mtp = new MaskedTextProvider ("aaa");
			mtp.InsertAt ('z', 0);
			mtp.InsertAt ('z', 1);
			Assert.AreEqual (true, mtp.InsertAt (' ', 0, out Int32_out, out MaskedTextResultHint_out), "#E1");
			Assert.AreEqual (" zz", mtp.ToString (), "E2");
			Assert.AreEqual (0, Int32_out, "E3");
			Assert.AreEqual (MaskedTextResultHint.Success, MaskedTextResultHint_out, "E4");
			MaskedTextProviderTest.AssertProperties (mtp, "InsertAt_charTest_E", 1, true, false, 2, 1, CultureInfo.GetCultureInfo ("es-ES"), 3, true, false, false, 2, 3, @"aaa", true, false, '\x0', '\x5F', true, true, true, @" zz", @" zz", @" zz", @"_zz", @"_zz", @" zz", @" zz");

			// Insert number over empty position with other characters later in the string.
			mtp = new MaskedTextProvider (@"aaa");
			mtp.InsertAt ('\x33', 2);
			Assert.AreEqual (true, mtp.InsertAt ('\x34', 0, out Int32_out, out MaskedTextResultHint_out), "#F1");
			Assert.AreEqual ("4 3", mtp.ToString (), "F2");
			Assert.AreEqual (0, Int32_out, "F3");
			Assert.AreEqual (MaskedTextResultHint.Success, MaskedTextResultHint_out, "F4");
			MaskedTextProviderTest.AssertProperties (mtp, "InsertAt_charTest_F", 1, true, false, 2, 1, CultureInfo.GetCultureInfo ("es-ES"), 3, true, false, false, 2, 3, @"aaa", true, false, '\x0', '\x5F', true, true, true, @"4 3", @"4 3", @"4 3", @"4_3", @"4_3", @"4 3", @"4 3");

			// insert space over literal with filled in positions later on (no more available edit positions)
			mtp = new MaskedTextProvider ("aba");
			mtp.InsertAt ('z', 0);
			mtp.InsertAt ('z', 1);
			mtp.InsertAt ('z', 2);
			Assert.AreEqual (false, mtp.InsertAt (' ', 1, out Int32_out, out MaskedTextResultHint_out), "#F1");
			Assert.AreEqual ("zbz", mtp.ToString (), "F2");
			Assert.AreEqual (3, Int32_out, "F3");
			Assert.AreEqual (MaskedTextResultHint.UnavailableEditPosition, MaskedTextResultHint_out, "F4");
			MaskedTextProviderTest.AssertProperties (mtp, "InsertAt_charTest_F", 1, true, false, 2, 0, CultureInfo.GetCultureInfo ("es-ES"), 2, true, false, false, 2, 3, @"aba", true, true, '\x0', '\x5F', true, true, true, @"zbz", @"zbz", @"zbz", @"zbz", @"zz", @"zbz", @"zz");

			// insert space over literal with filled in positions later on ( more available edit positions)
			mtp = new MaskedTextProvider ("abaa");
			mtp.InsertAt ('z', 0);
			mtp.InsertAt ('z', 2);
			Assert.AreEqual (true, mtp.InsertAt (' ', 1, out Int32_out, out MaskedTextResultHint_out), "#G1");
			Assert.AreEqual ("zb z", mtp.ToString (), "G2");
			Assert.AreEqual (2, Int32_out, "G3");
			Assert.AreEqual (MaskedTextResultHint.Success, MaskedTextResultHint_out, "G4");
			MaskedTextProviderTest.AssertProperties (mtp, "InsertAt_charTest_G", 1, true, false, 2, 1, CultureInfo.GetCultureInfo ("es-ES"), 3, true, false, false, 3, 4, @"abaa", true, false, '\x0', '\x5F', true, true, true, @"zb z", @"zb z", @"zb z", @"zb_z", @"z_z", @"zb z", @"z z");

			// insert space over literal with only more literals later on
			mtp = new MaskedTextProvider ("abb");
			Assert.AreEqual (false, mtp.InsertAt (' ', 1, out Int32_out, out MaskedTextResultHint_out), "#G1");
			Assert.AreEqual (" bb", mtp.ToString (), "G2");
			Assert.AreEqual (3, Int32_out, "G3");
			Assert.AreEqual (MaskedTextResultHint.UnavailableEditPosition, MaskedTextResultHint_out, "G4");
			MaskedTextProviderTest.AssertProperties (mtp, "InsertAt_charTest_G", 1, true, false, 0, 1, CultureInfo.GetCultureInfo ("es-ES"), 1, true, false, false, -1, 3, @"abb", true, false, '\x0', '\x5F', true, true, true, @" bb", @" bb", @" bb", @"_bb", @"_", @" bb", @"");

		}
开发者ID:peterdocter,项目名称:mono,代码行数:90,代码来源:MaskedTextProviderTest.cs

示例12: CloneTest

		public void CloneTest ()
		{
			MaskedTextProvider mtp;
			MaskedTextProvider mtp2;
			int counter = 0;

			mtp = new MaskedTextProvider ("mask");
			mtp2 = (MaskedTextProvider)mtp.Clone ();
			Assert.AreEqual (mtp.Mask, mtp2.Mask, "#" + (counter++).ToString ());
			AssertProperties (mtp2, "CloneTest", counter++, mtp.AllowPromptAsInput, mtp.AsciiOnly, mtp.AssignedEditPositionCount, mtp.AvailableEditPositionCount, mtp.Culture, mtp.EditPositionCount, mtp.IncludeLiterals, mtp.IncludePrompt, mtp.IsPassword, mtp.LastAssignedPosition, mtp.Length, mtp.Mask, mtp.MaskCompleted, mtp.MaskFull, mtp.PasswordChar, mtp.PromptChar, mtp.ResetOnPrompt, mtp.ResetOnSpace, mtp.SkipLiterals, mtp.ToString (), mtp.ToString (true), mtp.ToString (false), mtp.ToString (true, true), mtp.ToString (true, false), mtp.ToString (false, true), mtp.ToString (false, false));
		}
开发者ID:peterdocter,项目名称:mono,代码行数:11,代码来源:MaskedTextProviderTest.cs

示例13: HasValue

 /// <summary>
 /// Checks if the editor has value or not.
 /// </summary>
 /// <returns>Return true if the editor has a value.</returns>
 private bool HasValue()
 {
     bool lResult = true;
     if (Mask != null && !Mask.Equals(string.Empty))
     {
         // Only String and Time data types can have masks in this Presentation. Check them separately.
         if (mDataType == ModelType.Time)
         {
             // Get the Time value without Time separators in order to check if the editor control has value.
             string lAuxStringValue = mMaskedTextBoxIT.Text.Replace(mMaskedTextBoxIT.Culture.DateTimeFormat.TimeSeparator, "");
             lResult = !string.IsNullOrEmpty(lAuxStringValue.Trim());
         }
         else
         {
             // String data type.
             MaskedTextProvider maskTextProvider = new MaskedTextProvider(Mask);
             maskTextProvider.IncludeLiterals = false;
             if (!maskTextProvider.VerifyString(mMaskedTextBoxIT.Text))
             {
                 // If the value assigned to the control does not satisfies the mask,
                 // check if the editor control Text has value.
                 lResult = (mMaskedTextBoxIT.Text != string.Empty);
             }
             else
             {
                 // If the value assigned satisfies the mask
                 // (it is not mandatory that the mask has been completed),
                 // assign the value to the MaskTextProvider and then check if
                 // it has value.
                 maskTextProvider.Set(mMaskedTextBoxIT.Text);
                 string auxString = maskTextProvider.ToString(false, false);
                 lResult = !string.IsNullOrEmpty(auxString);
             }
         }
     }
     else
     {
         lResult = !mMaskedTextBoxIT.Text.Equals(string.Empty);
     }
     return lResult;
 }
开发者ID:sgon1853,项目名称:UPM_MDD_Thesis,代码行数:45,代码来源:MaskedTextBoxPresentation.cs

示例14: CnpjFormat

 public static string CnpjFormat(string cnpj)
 {
     var mtpCnpj = new MaskedTextProvider(@"00\.000\.000/0000-00");
     mtpCnpj.Set(LeadingZeros(cnpj, 11));
     return mtpCnpj.ToString();
 }
开发者ID:andreluizsombra,项目名称:Multiarkivos,代码行数:6,代码来源:StringFormatHelper.cs

示例15: GetRawText

 private static string GetRawText( MaskedTextProvider provider )
 {
     return provider.ToString( true, false, false, 0, provider.Length );
 }
开发者ID:eolandezhang,项目名称:Diagram,代码行数:4,代码来源:MaskedTextBox.cs


注:本文中的System.ComponentModel.MaskedTextProvider.ToString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。