BrightIdeasSoftware.ObjectListView.HandleContextMenu C# (CSharp) Method

HandleContextMenu() protected method

The user wants to see the context menu.
We want to ignore context menu requests that are triggered by right clicks on the header
protected HandleContextMenu ( Message &m ) : bool
m Message The windows m
return bool
        protected virtual bool HandleContextMenu(ref Message m)
        {
            // Don't try to handle context menu commands at design time.
            if (this.DesignMode)
                return false;

            // If the context menu command was generated by the keyboard, LParam will be -1.
            // We don't want to process these.
            if (m.LParam == this.minusOne)
                return false;

            // If the context menu came from somewhere other than the header control,
            // we also don't want to ignore it
            if (m.WParam != this.HeaderControl.Handle)
                return false;

            // OK. Looks like a right click in the header
            if (!this.PossibleFinishCellEditing())
                return true;

            int columnIndex = this.HeaderControl.ColumnIndexUnderCursor;
            return this.HandleHeaderRightClick(columnIndex);
        }
ObjectListView