// SET--SelectedBackColor
        public void SetSelectedBackColor(Control control, Color selColor)
        {
            TextBoxInfo info;
            TextBox     t = (TextBox)control;

            if (!Extendees.ContainsKey(t))
            {
                info = new TextBoxInfo();
            }
            else
            {
                info = (TextBoxInfo)Extendees[t];
            }

            // Store the new value
            info.SelectedBackColor = selColor;

            // If not already done, wire events up
            if (!info.EventWired)
            {
                t.GotFocus     += new EventHandler(TextBox_GotFocus);
                t.LostFocus    += new EventHandler(TextBox_LostFocus);
                info.EventWired = true;
            }

            // Add to the table
            if (!Extendees.ContainsKey(t))
            {
                Extendees[t] = info;
            }
        }
        // GET--SelectedBackColor
        public Color GetSelectedBackColor(Control control)
        {
            // Retrieve related info
            TextBox     t    = (TextBox)control;
            TextBoxInfo info = (TextBoxInfo)Extendees[t];

            return(info.SelectedBackColor);
        }
        private void TextBox_LostFocus(object sender, EventArgs e)
        {
            // Retrieve related info
            TextBox     t    = (TextBox)sender;
            TextBoxInfo info = (TextBoxInfo)Extendees[t];

            // Update the info and changes the control's UI
            t.BackColor       = info.OldBackColor;
            info.OldBackColor = Color.Empty;
            t.ForeColor       = info.OldForeColor;
            info.OldForeColor = Color.Empty;
        }
Esempio n. 4
0
		// SET--SelectedBackColor
		public void SetSelectedBackColor(Control control, Color selColor)
		{
			TextBoxInfo info; 
			TextBox t = (TextBox) control;
			if (!Extendees.ContainsKey(t))
				info = new TextBoxInfo();
			else
				info = (TextBoxInfo) Extendees[t];
 
			// Store the new value
			info.SelectedBackColor = selColor;

			// If not already done, wire events up
			if (!info.EventWired)
			{
				t.GotFocus += new EventHandler(TextBox_GotFocus);
				t.LostFocus += new EventHandler(TextBox_LostFocus);
				info.EventWired = true;
			}

			// Add to the table
			if (!Extendees.ContainsKey(t))
				Extendees[t] = info;
		}