예제 #1
0
 private void DrawBaseCaroText()
 {
     baseTextBox = new BaseTextBox
     {
         Location = new Point(0, 0)
     };
     requiredLbl = new Label
     {
         Location  = new Point(0, 30),
         Visible   = false,
         ForeColor = Color.Red
     };
     this.Controls.Add(baseTextBox);
     this.Controls.Add(requiredLbl);
 }
예제 #2
0
        private void BaseTextBox_TextChanged(object sender, EventArgs e)
        {
            BaseTextBox baseText = sender as BaseTextBox;

            if (baseText != null)
            {
                if (ValidateText == null)
                {
                    return;
                }
                if (!ValidateText(baseText.Text))
                {
                    baseText.BorderColor = Color.Red;
                    requiredLbl.Visible  = true;
                }
                else
                {
                    baseText.BorderColor = Color.Blue;
                    requiredLbl.Visible  = false;
                }
            }
        }