System.Windows.Forms.DataGridView.OnColumnHeaderMouseClick(System.Windows.Forms.DataGridViewCellMouseEventArgs)

Here are the examples of the csharp api class System.Windows.Forms.DataGridView.OnColumnHeaderMouseClick(System.Windows.Forms.DataGridViewCellMouseEventArgs) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

1 Example 7

1. Example

Project: HostsFileEditor
Source File: HostsEntryDataGridView.cs
protected override void OnColumnHeaderMouseClick(DataGridViewCellMouseEventArgs e)
        {
            base.OnColumnHeaderMouseClick(e);

            if (this.SortedColumn == lastSortedColumn)
            {
                this.currentSortState++;

                // After sorting twice (ascending then descending) clear the sort
                if (this.currentSortState > 2)
                {
                    this.BeginInvoke(
                        (MethodInvoker)delegate()
                        {
                            Application.DoEvents();
                            if (this.ClearSort != null)
                            {
                                this.ClearSort();
                            }
                        });

                    this.currentSortState = 0;
                    this.lastSortedColumn = null;
                }
            }
            else
            {
                this.currentSortState = 1;
                this.lastSortedColumn = this.Columns[e.ColumnIndex];
            }
        }