Beispiel #1
0
        private void Tb_TextChanged(object sender, EventArgs e)
        {
            TextBox      tb  = sender as TextBox;
            ColorTextBox rtb = tb.Tag as ColorTextBox;

            if (rtb == null)
            {
                tb.Visible = true;
                return;
            }
            rtb.Lines = tb.Lines;
        }
Beispiel #2
0
 public ColoredSecureTextBox()
 {
     if (DesignMode)
     {
         return;
     }
     m_text = new ColorTextBox();
     m_text.ParentChanged += M_text_ParentChanged;
     TextChanged          += ColoredSecureTextBoxChanged;
     GotFocus             += OnFocusChangeRequired;
     EnabledChanged       += UpdateEnabledState;
     m_text.Size           = Size;
     m_text.Location       = Location;
     LocationChanged      += ColoredSecureTextBox_LocationChanged;
     SizeChanged          += ColoredSecureTextBox_SizeChanged;
 }
 public ColoredSecureTextBox()
 {
     if (DesignMode)
     {
         return;
     }
     m_text = new ColorTextBox();
     m_text.ParentChanged += M_text_ParentChanged;
     TextChanged          += ColoredSecureTextBoxChanged;
     GotFocus             += OnFocusChangeRequired;
     EnabledChanged       += UpdateEnabledState;
     m_text.Size           = Size;
     m_text.Location       = Location;
     LocationChanged      += ColoredSecureTextBox_LocationChanged;
     SizeChanged          += ColoredSecureTextBox_SizeChanged;
     //Focus change is no longer triggered since KeePass 2.49
     Enter += OnFocusChangeRequired;
 }
Beispiel #4
0
        //Color passwords in password generator
        private void OnPwGeneratorFormShown(object sender, EventArgs e)
        {
            (sender as Form).Shown -= OnPwGeneratorFormShown;
            if (!ColorConfig.Active)
            {
                return;
            }
            if (!ColorConfig.ColorPwGen)
            {
                return;
            }
            KeePass.Forms.PwGeneratorForm pg = sender as KeePass.Forms.PwGeneratorForm;
            TextBox tb = Tools.GetControl("m_tbPreview", pg) as TextBox;

            if (tb == null)
            {
                PluginDebug.AddError("Could not locate m_tbPreview", 0);
                return;
            }
            ColorTextBox rtb = new ColorTextBox();

            rtb.Name            = "ColoredPassword_" + tb.Name;
            rtb.Left            = tb.Left;
            rtb.Top             = tb.Top;
            rtb.Width           = tb.Width;
            rtb.Height          = tb.Height;
            rtb.ColorBackground = false;
            rtb.Multiline       = tb.Multiline;
            rtb.ReadOnly        = tb.ReadOnly;
            rtb.WordWrap        = tb.WordWrap;
            rtb.Font            = tb.Font;
            rtb.ScrollBars      = (RichTextBoxScrollBars)tb.ScrollBars;
            tb.Tag     = rtb;
            tb.Visible = false;
            tb.Parent.Controls.Add(rtb);
            tb.TextChanged += Tb_TextChanged;
        }