mirror of https://github.com/2dust/v2rayN
YFdyh000
5 years ago
3 changed files with 48 additions and 0 deletions
@ -0,0 +1,31 @@
|
||||
using System; |
||||
using System.Collections; |
||||
using System.Collections.Generic; |
||||
using System.Linq; |
||||
using System.Text; |
||||
using System.Threading.Tasks; |
||||
using System.Windows.Forms; |
||||
|
||||
namespace v2rayN.Base |
||||
{ |
||||
public class ListViewSort : IComparer |
||||
{ |
||||
private int col; |
||||
private bool descK; |
||||
public ListViewSort() |
||||
{ |
||||
col = 0; |
||||
} |
||||
public ListViewSort(int column, object Desc) |
||||
{ |
||||
descK = (bool)Desc; |
||||
col = column; //当前列,0,1,2...,参数由ListView控件的ColumnClick事件传递 |
||||
} |
||||
public int Compare(object x, object y) |
||||
{ |
||||
int tempInt = String.Compare(((ListViewItem)x).SubItems[col].Text, ((ListViewItem)y).SubItems[col].Text); |
||||
if (descK) return -tempInt; |
||||
else return tempInt; |
||||
} |
||||
} |
||||
} |
Loading…
Reference in new issue