32 lines
787 B
C#
32 lines
787 B
C#
using System;
|
|
using System.Collections;
|
|
using System.Windows.Forms;
|
|
|
|
namespace TracingDB.Forms
|
|
{
|
|
public class LviIntColumnComparer : IComparer
|
|
{
|
|
int column;
|
|
SortOrder order;
|
|
|
|
public LviIntColumnComparer()
|
|
{
|
|
column = 0;
|
|
order = SortOrder.Ascending;
|
|
}
|
|
|
|
public LviIntColumnComparer(int column, SortOrder order)
|
|
{
|
|
this.column = column;
|
|
this.order = order;
|
|
}
|
|
|
|
public int Compare(object x, object y)
|
|
{
|
|
int valX = int.Parse(((ListViewItem)x).SubItems[column].Text);
|
|
int valY = int.Parse(((ListViewItem)y).SubItems[column].Text);
|
|
return (order == SortOrder.Descending) ? (valY - valX) : (valX - valY);
|
|
}
|
|
}
|
|
}
|