public Sort ( |
||
column | ||
direction | ListSortDirection | |
리턴 | void |
protected override void OnMouseUp(MouseEventArgs e) { base.OnMouseUp(e); if (resizeType != resizeTypes.None) { return; } if (table == null) { return; } switch (e.Button) { case MouseButtons.Left: // Sort. lastSortDirection = GetNextSortDirection(); table.Sort(column, lastSortDirection); break; case MouseButtons.Right: // Create context menu. ContextMenuStrip contextMenu = new ContextMenuStrip(); var itemSort = new ToolStripMenuItem("Sort"); contextMenu.Items.Add(itemSort); var itemSortAsc = new ToolStripMenuItem("Ascending"); itemSortAsc.Click += (s, a) => { lastSortDirection = ListSortDirection.Ascending; table.Sort(column, lastSortDirection); }; var itemSortDesc = new ToolStripMenuItem("Descending"); itemSortDesc.Click += (s, a) => { lastSortDirection = ListSortDirection.Descending; table.Sort(column, lastSortDirection); }; itemSort.DropDownItems.Add(itemSortAsc); itemSort.DropDownItems.Add(itemSortDesc); contextMenu.Show(null, MousePosition); break; } }