Пример #1
0
        private void SetupTextBoxMessageHandler()
        {
#if FRAMEWORK20
            if (this.DropDownStyle != ComboBoxStyle.DropDownList && this.AutoCompleteMode == AutoCompleteMode.None)
#else
            if (this.DropDownStyle != ComboBoxStyle.DropDownList)
#endif
            {
                if (m_TextWindowMsgHandler == null)
                {
                    // Get hold of the text box
                    IntPtr hwnd = GetWindow(this.Handle, GW_CHILD);
                    // Subclass so we can track messages
                    if (hwnd != IntPtr.Zero)
                    {
                        m_TextWindowMsgHandler = new ComboTextBoxMsgHandler();
                        m_TextWindowMsgHandler.MouseLeave += new EventHandler(this.TextBoxMouseLeave);
                        m_TextWindowMsgHandler.Paint += new PaintEventHandler(TextBoxPaint);
                        m_TextWindowMsgHandler.AssignHandle(hwnd);
                    }
                }
            }
            else if (m_TextWindowMsgHandler != null)
            {
                m_TextWindowMsgHandler.ReleaseHandle();
                m_TextWindowMsgHandler = null;
            }
        }
Пример #2
0
        /*protected override void OnEnabledChanged(EventArgs e)
        {
            base.OnEnabledChanged(e);
            SyncTimerEnabled();
        }*/

        /*private void SyncTimerEnabled()
        {
            if(this.Visible)
            {
                if(!m_Timer.Enabled && this.Enabled && !this.DesignMode)
                    m_Timer.Enabled=true;
            }
            else
            {
                if(m_Timer.Enabled)
                    m_Timer.Enabled=false;
            }
        }*/

        /// <summary> 
        /// Clean up any resources being used.
        /// </summary>
        protected override void Dispose(bool disposing)
        {
            /*if(m_Timer!=null)
            {
                if(m_Timer.Enabled)
                    m_Timer.Enabled=false;
                m_Timer.Dispose();
                m_Timer=null;
            }*/
            if (m_MouseOverTimer != null)
            {
                m_MouseOverTimer.Enabled = false;
                m_MouseOverTimer.Dispose();
                m_MouseOverTimer = null;
            }
            m_DisableInternalDrawing = true;
            if (m_TextWindowMsgHandler != null)
            {
                m_TextWindowMsgHandler.ReleaseHandle();
                m_TextWindowMsgHandler = null;
            }
            ReleasePopupHandler();
            if (_MultiColumnDisplay != null)
            {
                _MultiColumnDisplay.AfterNodeSelect -= TreeAfterNodeSelect;
                _MultiColumnDisplay.BeforeNodeSelect -= TreeBeforeNodeSelect;
                _MultiColumnDisplay.NodeMouseDown -= TreeNodeMouseDown;
                _MultiColumnDisplay.DataColumnCreated -= TreeDataColumnCreated;
                _MultiColumnDisplay.KeyDown -= TreeKeyDown;
                _MultiColumnDisplay.Dispose();
                _MultiColumnDisplay = null;
            }
            if (_PopupController != null)
            {
                _PopupController.Closed -= PopupControllerClosed;
                _PopupController.Dispose();
                _PopupController = null;
            }
            base.Dispose(disposing);
        }