61 lines
1.6 KiB
C#
61 lines
1.6 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace JRCookbookControls
|
|
{
|
|
public class JRCookbookMaskedTextBox: System.Windows.Forms.MaskedTextBox
|
|
{
|
|
private bool _blnMaskFullOnEnter = false;
|
|
private bool _blnAutoTab = false;
|
|
|
|
public JRCookbookMaskedTextBox()
|
|
{
|
|
this.Enter += new System.EventHandler(this.MaskedTextBox_Enter);
|
|
this.TextChanged += new System.EventHandler(this.MaskedTextBox_TextChanged);
|
|
|
|
|
|
}
|
|
|
|
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
|
|
public bool AutoTab
|
|
{
|
|
get
|
|
{
|
|
return _blnAutoTab;
|
|
}
|
|
set
|
|
{
|
|
_blnAutoTab = value;
|
|
}
|
|
}
|
|
|
|
private void MaskedTextBox_Enter(System.Object sender, System.EventArgs eventArgs)
|
|
{
|
|
_blnMaskFullOnEnter = this.MaskFull;
|
|
}
|
|
|
|
private void MaskedTextBox_TextChanged(System.Object sender, System.EventArgs eventArgs)
|
|
{
|
|
//Auto-tab if the mask is full
|
|
if (AutoTab)
|
|
{
|
|
if (_blnMaskFullOnEnter == false)
|
|
{
|
|
if (this.Focused)
|
|
{
|
|
if (this.MaskFull)
|
|
{
|
|
this.Parent.SelectNextControl(this, true, true, true, true);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|