Ejemplo n.º 1
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;
            }
        }
Ejemplo n.º 2
0
        // GET--SelectedBackColor
        public Color GetSelectedBackColor(Control control)
        {
            // Retrieve related info
            TextBox     t    = (TextBox)control;
            TextBoxInfo info = (TextBoxInfo)Extendees[t];

            return(info.SelectedBackColor);
        }
Ejemplo n.º 3
0
        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;
        }
Ejemplo 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;
		}