Ejemplo n.º 1
0
        /// <summary>
        /// BackGround Color Change
        /// </summary>
        /// <param name="sender">object</param>
        /// <param name="e">click</param>
        private void OnLeave(object sender, EventArgs e)
        {
            TerraScanMaskedTextBox terraScanMaskedTextBox = (TerraScanMaskedTextBox)sender;

            if (this.ApplyFocusColor)
            {
                terraScanMaskedTextBox.BackColor = this.textBoxBackColor;
                terraScanMaskedTextBox.ForeColor = this.textBoxForeColor;
                if (this.ApplyParentFocusColor == true)
                {
                    if (this.Parent.GetType() == typeof(System.Windows.Forms.Panel))
                    {
                        Panel parentPanel = (Panel)this.Parent;
                        parentPanel.BackColor = this.panelBackColor;
                    }
                }
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Method used to set focus color for control on enter event
        /// </summary>
        /// <param name="sender">Masktextbox</param>
        /// <param name="e">enter</param>
        private void OnEnter(object sender, EventArgs e)
        {
            TerraScanMaskedTextBox terraScanMaskedTextBox = (TerraScanMaskedTextBox)sender;

            if (this.ApplyFocusColor)
            {
                this.textBoxBackColor            = terraScanMaskedTextBox.BackColor;
                this.textBoxForeColor            = terraScanMaskedTextBox.ForeColor;
                terraScanMaskedTextBox.BackColor = this.SetFocusColor;
                terraScanMaskedTextBox.ForeColor = System.Drawing.Color.Black;
                if (this.ApplyParentFocusColor == true)
                {
                    if (this.Parent.GetType() == typeof(System.Windows.Forms.Panel))
                    {
                        Panel parentPanel = (Panel)this.Parent;
                        this.panelBackColor   = parentPanel.BackColor;
                        parentPanel.BackColor = this.SetFocusColor;
                    }
                }
            }

            this.SelectAll();
        }