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


C# MaskedTextProvider.RemoveAt方法代码示例

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


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

示例1: CanDelete

        private bool CanDelete( int startPosition, int selectionLength, bool deleteForward, MaskedTextProvider provider )
        {
            if( this.IsReadOnly )
            return false;

              if( selectionLength == 0 )
              {
            if( !deleteForward )
            {
              if( startPosition == 0 )
            return false;

              startPosition--;
            }
            else if( ( startPosition + selectionLength ) == provider.Length )
            {
              return false;
            }
              }

              MaskedTextResultHint notUsed;
              int tentativeCaretPosition = startPosition;

              int endPosition = ( selectionLength > 0 ) ? ( ( startPosition + selectionLength ) - 1 ) : startPosition;

              bool success = provider.RemoveAt( startPosition, endPosition, out tentativeCaretPosition, out notUsed );

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

示例2: CanReplace

        internal virtual bool CanReplace( MaskedTextProvider provider, string text, int startPosition, int selectionLength, bool rejectInputOnFirstFailure, out int tentativeCaretIndex )
        {
            int endPosition = ( startPosition + selectionLength ) - 1;
              tentativeCaretIndex = -1;

              bool success = false;

              foreach( char ch in text )
              {
            if( !m_maskedTextProvider.VerifyEscapeChar( ch, startPosition ) )
            {
              int editPositionFrom = provider.FindEditPositionFrom( startPosition, true );

              if( editPositionFrom == MaskedTextProvider.InvalidIndex )
            break;

              startPosition = editPositionFrom;
            }

            int length = ( endPosition >= startPosition ) ? 1 : 0;
            bool overwrite = length > 0;

            if( this.PlaceChar( provider, ch, startPosition, length, overwrite, out tentativeCaretIndex ) )
            {
              // Only one successfully inserted character is enough to declare the replace operation successful.
              success = true;

              startPosition = tentativeCaretIndex + 1;
            }
            else if( rejectInputOnFirstFailure )
            {
              return false;
            }
              }

              if( ( selectionLength > 0 ) && ( startPosition <= endPosition ) )
              {

            // Erase the remaining of the assigned edit character.
            int notUsed;
            MaskedTextResultHint notUsedHint;
            if( !provider.RemoveAt( startPosition, endPosition, out notUsed, out notUsedHint ) )
              success = false;
              }

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

示例3: RemoveAtTest

		public void RemoveAtTest ()
		{
			MaskedTextProvider mtp;
			int Int32_out = 0;
			MaskedTextResultHint MaskedTextResultHint_out = MaskedTextResultHint.Unknown;
			mtp = new MaskedTextProvider (@"aaaaaaaaaaaa");
			mtp.Add ("123456789");
			mtp.RemoveAt (3, 6, out Int32_out, out MaskedTextResultHint_out);
			Assert.AreEqual (3, Int32_out, "#A1");
			Assert.AreEqual (MaskedTextResultHint.Success, MaskedTextResultHint_out, "#A2");
			MaskedTextProviderTest.AssertProperties (mtp, "RemoveAtTest_A", 1, true, false, 5, 7, CultureInfo.GetCultureInfo ("es-ES"), 12, true, false, false, 4, 12, @"aaaaaaaaaaaa", true, false, '\x0', '\x5F', true, true, true, @"12389", @"12389", @"12389", @"12389_______", @"12389_______", @"12389", @"12389");

			mtp = new MaskedTextProvider (@"La");
			mtp.Add ("z1");
			mtp.RemoveAt (0, 1, out Int32_out, out MaskedTextResultHint_out);
			Assert.AreEqual (0, Int32_out, "#B1");
			Assert.AreEqual (MaskedTextResultHint.Success, MaskedTextResultHint_out, "#B2");
			MaskedTextProviderTest.AssertProperties (mtp, "RemoveAtTest_B", 1, true, false, 0, 2, CultureInfo.GetCultureInfo ("es-ES"), 2, true, false, false, -1, 2, @"La", false, false, '\x0', '\x5F', true, true, true, @"", @"", @"", @"__", @"__", @"", @"");

			mtp = new MaskedTextProvider (@"La");
			mtp.Add ("z1");
			mtp.RemoveAt (0, 1, out Int32_out, out MaskedTextResultHint_out);
			Assert.AreEqual (0, Int32_out, "#B1");
			Assert.AreEqual (MaskedTextResultHint.Success, MaskedTextResultHint_out, "#B2");
			MaskedTextProviderTest.AssertProperties (mtp, "RemoveAtTest_B", 1, true, false, 0, 2, CultureInfo.GetCultureInfo ("es-ES"), 2, true, false, false, -1, 2, @"La", false, false, '\x0', '\x5F', true, true, true, @"", @"", @"", @"__", @"__", @"", @"");

			// Remove non-assigned character with assigned characters later on.
			mtp = new MaskedTextProvider (@"aaaaaaaaaaaa");
			mtp.InsertAt ("1", 1);
			mtp.RemoveAt (0, 0, out Int32_out, out MaskedTextResultHint_out);
			Assert.AreEqual (0, Int32_out, "#C1");
			Assert.AreEqual (MaskedTextResultHint.SideEffect, MaskedTextResultHint_out, "#C2");
			MaskedTextProviderTest.AssertProperties (mtp, "RemoveAtTest_C", 1, true, false, 1, 11, CultureInfo.GetCultureInfo ("es-ES"), 12, true, false, false, 0, 12, @"aaaaaaaaaaaa", true, false, '\x0', '\x5F', true, true, true, @"1", @"1", @"1", @"1___________", @"1___________", @"1", @"1");

			// Remove assigned+non-assigned character with assigned characters later on.
			mtp = new MaskedTextProvider (@"aaaaaaaaaaaa");
			mtp.InsertAt ("1", 1);
			mtp.InsertAt ("4", 4);
			mtp.RemoveAt (1, 2, out Int32_out, out MaskedTextResultHint_out);
			Assert.AreEqual (1, Int32_out, "#D1");
			Assert.AreEqual (MaskedTextResultHint.Success, MaskedTextResultHint_out, "#D2");
			MaskedTextProviderTest.AssertProperties (mtp, "RemoveAtTest_D", 1, true, false, 1, 11, CultureInfo.GetCultureInfo ("es-ES"), 12, true, false, false, 2, 12, @"aaaaaaaaaaaa", true, false, '\x0', '\x5F', true, true, true, @"  4", @"  4", @"  4", @"__4_________", @"__4_________", @"  4", @"  4");

			// Remove non-assigned+assigned character with assigned characters later on.
			mtp = new MaskedTextProvider (@"aaaaaaaaaaaa");
			mtp.InsertAt ("1", 1);
			mtp.InsertAt ("4", 4);
			mtp.RemoveAt (0, 1, out Int32_out, out MaskedTextResultHint_out);
			Assert.AreEqual (0, Int32_out, "#E1");
			Assert.AreEqual (MaskedTextResultHint.Success, MaskedTextResultHint_out, "#E2");
			MaskedTextProviderTest.AssertProperties (mtp, "RemoveAtTest_E", 1, true, false, 1, 11, CultureInfo.GetCultureInfo ("es-ES"), 12, true, false, false, 2, 12, @"aaaaaaaaaaaa", true, false, '\x0', '\x5F', true, true, true, @"  4", @"  4", @"  4", @"__4_________", @"__4_________", @"  4", @"  4");

			// Remove 2 characters with a assigned character just after that cannot be removed 1 character.
			mtp = new MaskedTextProvider (@"aaaLaaaaaaaa");
			mtp.Add ("012Z4");
			mtp.RemoveAt (0, 1, out Int32_out, out MaskedTextResultHint_out);
			Assert.AreEqual (0, Int32_out, "#F1");
			Assert.AreEqual (MaskedTextResultHint.Success, MaskedTextResultHint_out, "#F2");
			MaskedTextProviderTest.AssertProperties (mtp, "RemoveAtTest_F", 1, true, false, 3, 9, CultureInfo.GetCultureInfo ("es-ES"), 12, true, false, false, 2, 12, @"aaaLaaaaaaaa", false, false, '\x0', '\x5F', true, true, true, @"2Z4", @"2Z4", @"2Z4", @"2Z4_________", @"2Z4_________", @"2Z4", @"2Z4");

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


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