Initial population
This commit is contained in:
60
JRCookbookControls/JRCookbookMaskedTextBox.cs
Normal file
60
JRCookbookControls/JRCookbookMaskedTextBox.cs
Normal file
@@ -0,0 +1,60 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user