Пример #1
0
 protected virtual void OnAutoCompletingMask(AutoCompletingMaskEventArgs e)
 {
     if (AutoCompletingMask != null)
         AutoCompletingMask(this, e);
 }
Пример #2
0
        private bool PlaceChar(MaskedTextProvider provider, char ch, int startPosition, int length, bool overwrite,
            out int caretPosition)
        {
            if (ShouldQueryAutoCompleteMask(provider.Clone() as MaskedTextProvider, ch, startPosition))
            {
                AutoCompletingMaskEventArgs e = new AutoCompletingMaskEventArgs(
                    m_maskedTextProvider.Clone() as MaskedTextProvider,
                    startPosition,
                    length,
                    ch.ToString());

                OnAutoCompletingMask(e);

                if ((!e.Cancel) && (e.AutoCompleteStartPosition > -1))
                {
                    caretPosition = startPosition;

                    // AutoComplete the block.
                    for (int i = 0; i < e.AutoCompleteText.Length; i++)
                    {
                        if (
                            !PlaceCharCore(provider, e.AutoCompleteText[i], e.AutoCompleteStartPosition + i, 0, true,
                                out caretPosition))
                            return false;
                    }

                    caretPosition = e.AutoCompleteStartPosition + e.AutoCompleteText.Length;
                    return true;
                }
            }

            return PlaceCharCore(provider, ch, startPosition, length, overwrite, out caretPosition);
        }