private void OnTextChange(object sender, TextCompositionEventArgs e) // comprobaciones antes de que se escriba e impedir entradas incorrectas
        {
            TextBox textBox    = sender as TextBox;                          // obtengo el textbox que produjo el evento
            string  ActualText = textBox.Text + e.Text;

            if (textBox.Name == txt_hex.Name) // compruebo el texto que se escribe en el cuadro de texto de hex
            {
                if (DesignControl.IsHex(e.Text))
                {
                    if (e.Text == "#" && ActualText.Length > 1)
                    {
                        e.Handled = true;
                    }
                }
                else
                {
                    e.Handled = true;
                }
            }
            else // compruebo el texto en los otros cuadros de texto
            {
                if (DesignControl.TextIsNumeric(e.Text))
                {
                    int number = Convert.ToInt32(ActualText);
                    if (textBox.Name != txt_alpha.Name)
                    {
                        e.Handled = !DesignControl.IsByte(number);
                    }
                    else
                    {
                        e.Handled = !DesignControl.IsPercent(number);
                    }
                }
                else
                {
                    e.Handled = true;
                }
            }
        }