Наследование: System.Windows.Forms.Button
Пример #1
0
		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		protected override void Dispose(bool disposing)
		{
			Debug.WriteLineIf(!disposing, "****************** Missing Dispose() call for " + GetType().Name + " ******************");
			// Must not be run more than once.
			if (IsDisposed)
				return;

			// m_sda COM object block removed due to crash in Finializer thread LT-6124

			if (disposing)
			{
				if (m_button != null)
				{
					m_button.MouseDown -= m_button_MouseDown;
					m_button.KeyDown -= m_button_KeyDown;
					m_button.GotFocus -= m_button_GotFocus;
					m_button.LostFocus -= m_button_LostFocus;
				}

				if (m_sda != null)
					m_sda.RemoveNotification(this);

				if (m_comboTextBox != null)
				{
					m_comboTextBox.KeyDown -= m_comboTextBox_KeyDown;
					m_comboTextBox.MouseDown -= m_comboTextBox_MouseDown;
					m_comboTextBox.GotFocus -= m_comboTextBox_GotFocus;
					m_comboTextBox.LostFocus -= m_comboTextBox_LostFocus;
				}

				if (m_dropDownBox != null && !m_dropDownBox.IsDisposed)
				{
					m_dropDownBox.Form.VisibleChanged -= Form_VisibleChanged;
					m_dropDownBox.Dispose();
				}
			}
			m_sda = null;
			m_button = null;
			m_comboTextBox = null;
			m_dropDownBox = null;

			base.Dispose(disposing);
		}
Пример #2
0
		/// <summary>
		/// Construct one.
		/// </summary>
		public FwComboBoxBase()
		{
			if (Application.RenderWithVisualStyles)
				DoubleBuffered = true;

			SuspendLayout();
			// Set this box's own properties (first, as we use some of them in figuring the
			// size of other things).

			// Make and install the ComboTextBox
			m_comboTextBox = new ComboTextBox(this);
			m_comboTextBox.AccessibleName = "TextBox";
			m_comboTextBox.Dock = DockStyle.Fill;
			m_comboTextBox.Visible = true;

			// This causes us to get a notification when the string gets changed, so we can fire our
			// TextChanged event.
			m_sda = m_comboTextBox.DataAccess;
			m_sda.AddNotification(this);

			m_comboTextBox.KeyDown += m_comboTextBox_KeyDown;
			m_comboTextBox.MouseDown += m_comboTextBox_MouseDown;
			m_comboTextBox.GotFocus += m_comboTextBox_GotFocus;
			m_comboTextBox.LostFocus += m_comboTextBox_LostFocus;
			m_comboTextBox.TabIndex = 1;
			m_comboTextBox.TabStop = true;

			m_textBoxPanel = new Panel();
			m_textBoxPanel.AccessibleName = "TextBoxPanel";
			m_textBoxPanel.Dock = DockStyle.Fill;
			m_textBoxPanel.BackColor = Color.Transparent;
			m_textBoxPanel.Controls.Add(m_comboTextBox);
			Controls.Add(m_textBoxPanel);

			// Make and install the button that pops up the list.
			m_button = new DropDownButton(this);
			m_button.AccessibleName = "DropDownButton";
			m_button.Dock = DockStyle.Right; // Enhance JohnT: Left if RTL language?
			m_button.TabStop = false;

			//m_button.FlatStyle = FlatStyle.Flat; // no raised edges etc for this button.
			////			m_button.Click += new EventHandler(m_button_Click);

			m_button.MouseDown += m_button_MouseDown;
			m_button.KeyDown += m_button_KeyDown;
			m_button.GotFocus += m_button_GotFocus;
			m_button.LostFocus += m_button_LostFocus;

			m_buttonPanel = new Panel();
			m_buttonPanel.AccessibleName = "DropDownButtonPanel";
			m_buttonPanel.Dock = DockStyle.Right;
			m_buttonPanel.BackColor = Color.Transparent;
			m_buttonPanel.Controls.Add(m_button);
			Controls.Add(m_buttonPanel);

			HasBorder = true;
			Padding = new Padding(Application.RenderWithVisualStyles ? 2 : 1);
			base.BackColor = SystemColors.Window;

			m_buttonPanel.Width = m_button.PreferredWidth + m_buttonPanel.Padding.Horizontal;

			m_dropDownBox = CreateDropDownBox();
			m_dropDownBox.Form.VisibleChanged += Form_VisibleChanged;

			ResumeLayout();
		}
Пример #3
0
		/// <summary>
		/// Construct one.
		/// </summary>
		public TreeCombo()
		{
			this.SuspendLayout();
			// Set this box's own properties (first, as we use some of them in figuring the
			// size of other things).

			// Make and install the ComboTextBox
			m_comboTextBox = new ComboTextBox(this);
			m_comboTextBox.AccessibleName = "TextBox";
			m_comboTextBox.Dock = DockStyle.Fill;
			m_comboTextBox.Visible = true;
			// Don't allow typing or pasting into the text box: see LT-6595.
			m_comboTextBox.ReadOnlyView = true;

			// These two lines causes us to get a notification when the string gets changed,
			// so we can fire our TextChanged event.
			m_sda = m_comboTextBox.DataAccess;
			m_sda.AddNotification(this);

			m_comboTextBox.MouseDown += new MouseEventHandler(m_comboTextBox_MouseDown);
			m_comboTextBox.KeyPress += new KeyPressEventHandler(m_comboTextBox_KeyPress);
			m_comboTextBox.KeyDown += new KeyEventHandler(m_comboTextBox_KeyDown);
			m_comboTextBox.GotFocus += new EventHandler(m_comboTextBox_GotFocus);
			m_comboTextBox.LostFocus += new EventHandler(m_comboTextBox_LostFocus);

			m_textBoxPanel = new Panel();
			m_textBoxPanel.AccessibleName = "TextBoxPanel";
			m_textBoxPanel.Dock = DockStyle.Fill;
			m_textBoxPanel.BackColor = Color.Transparent;
			m_textBoxPanel.Controls.Add(m_comboTextBox);
			this.Controls.Add(m_textBoxPanel);

			// Make and install the button that pops up the list.
			m_button = new DropDownButton(this);
			m_button.AccessibleName = "DropDownButton";
			m_button.Dock = DockStyle.Right; // Enhance JohnT: Left if RTL language?

			//m_button.FlatStyle = FlatStyle.Flat; // no raised edges etc for this button.
			m_button.MouseDown += new MouseEventHandler(m_button_MouseDown);
			m_button.GotFocus += new EventHandler(m_button_GotFocus);
			m_button.LostFocus += new EventHandler(m_button_LostFocus);
			m_button.TabStop = false;

			m_buttonPanel = new Panel();
			m_buttonPanel.AccessibleName = "DropDownButtonPanel";
			m_buttonPanel.Dock = DockStyle.Right;
			m_buttonPanel.BackColor = Color.Transparent;
			m_buttonPanel.Controls.Add(m_button);
			this.Controls.Add(m_buttonPanel);

			HasBorder = true;
			Padding = new Padding(Application.RenderWithVisualStyles ? 2 : 1);
			base.BackColor = SystemColors.Window;

			m_buttonPanel.Width = m_button.PreferredWidth + m_buttonPanel.Padding.Horizontal;

			// Create the list.
			m_popupTree = new PopupTree();
			m_popupTree.TabStopControl = m_comboTextBox;
			//m_tree.SelectedIndexChanged += new EventHandler(m_listBox_SelectedIndexChanged);
			//m_listBox.SameItemSelected += new EventHandler(m_listBox_SameItemSelected);
			m_popupTree.AfterSelect += new TreeViewEventHandler(m_tree_AfterSelect);
			m_popupTree.BeforeSelect += new TreeViewCancelEventHandler(m_popupTree_BeforeSelect);
			m_popupTree.Load += new EventHandler(m_tree_Load);
			m_popupTree.PopupTreeClosed += new TreeViewEventHandler(m_popupTree_PopupTreeClosed);
			m_popupTree.VisibleChanged += new EventHandler(m_popupTree_VisibleChanged);

			this.ResumeLayout();
		}
Пример #4
0
		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			//Debug.WriteLineIf(!disposing, "****************** " + GetType().Name + " 'disposing' is false. ******************");
			// Must not be run more than once.
			if (IsDisposed)
				return;

			// m_sda COM object block removed due to crash in Finializer thread LT-6124

			if (disposing)
			{
				if (m_button != null)
				{
					m_button.MouseDown -= new MouseEventHandler(m_button_MouseDown);
					m_button.GotFocus -= new EventHandler(m_button_GotFocus);
					m_button.LostFocus -= new EventHandler(m_button_LostFocus);
				}

				if (m_sda != null)
					m_sda.RemoveNotification(this);

				if (m_comboTextBox != null)
				{
					m_comboTextBox.KeyPress -= new KeyPressEventHandler(m_comboTextBox_KeyPress);
					m_comboTextBox.KeyDown -= new KeyEventHandler(m_comboTextBox_KeyDown);
					m_comboTextBox.MouseDown -= new MouseEventHandler(m_comboTextBox_MouseDown);
					m_comboTextBox.GotFocus -= new EventHandler(m_comboTextBox_GotFocus);
					m_comboTextBox.LostFocus -= new EventHandler(m_comboTextBox_LostFocus);
				}
				if (m_popupTree != null)
				{
					m_popupTree.AfterSelect -= new TreeViewEventHandler(m_tree_AfterSelect);
					m_popupTree.BeforeSelect -= new TreeViewCancelEventHandler(m_popupTree_BeforeSelect);
					m_popupTree.Load -= new EventHandler(m_tree_Load);
					m_popupTree.VisibleChanged -= new EventHandler(m_popupTree_VisibleChanged);
				}

				if (m_popupTree != null && !m_popupTree.IsDisposed)
					m_popupTree.Dispose();
			}
			m_button = null; // So OnLayout knows to do nothing.
			m_comboTextBox = null;
			m_popupTree = null;
			m_sda = null;

			base.Dispose(disposing);
		}
Пример #5
0
		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			//Debug.WriteLineIf(!disposing, "****************** " + GetType().Name + " 'disposing' is false. ******************");
			// Must not be run more than once.
			if (IsDisposed)
				return;

			// m_sda COM object block removed due to crash in Finializer thread LT-6124

			if (disposing)
			{
				if (m_button != null)
				{
					m_button.MouseDown -=new MouseEventHandler(m_button_MouseDown);
					m_button.KeyDown -=new KeyEventHandler(m_button_KeyDown);
					m_button.GotFocus -= new EventHandler(m_button_GotFocus);
					m_button.LostFocus -= new EventHandler(m_button_LostFocus);
				}

				if (m_sda != null)
					m_sda.RemoveNotification(this);

				if (m_comboTextBox != null)
				{
					m_comboTextBox.KeyPress -= new KeyPressEventHandler(m_comboTextBox_KeyPress);
					m_comboTextBox.KeyDown -= new KeyEventHandler(m_comboTextBox_KeyDown);
					m_comboTextBox.MouseDown -= new MouseEventHandler(m_comboTextBox_MouseDown);
					m_comboTextBox.GotFocus -= new EventHandler(m_comboTextBox_GotFocus);
					m_comboTextBox.LostFocus -= new EventHandler(m_comboTextBox_LostFocus);
				}
				if (m_comboListBox != null)
				{
					m_comboListBox.SelectedIndexChanged -= new EventHandler(m_listBox_SelectedIndexChanged);
					m_comboListBox.SameItemSelected -= new EventHandler(m_listBox_SameItemSelected);
					m_comboListBox.Form.VisibleChanged -= new EventHandler(Form_VisibleChanged);
					m_comboListBox.Dispose();
				}
			}
			m_sda = null;
			m_button = null;
			m_comboTextBox = null;
			m_comboListBox = null;
			if (m_tssPrevious != null)
			{
				Marshal.ReleaseComObject(m_tssPrevious);
				m_tssPrevious = null;
			}

			base.Dispose(disposing);
		}