32 lines
808 B
C#
32 lines
808 B
C#
using System;
|
|
using System.Collections;
|
|
using System.Windows.Forms;
|
|
|
|
namespace TracingDB.Forms
|
|
{
|
|
public class LviTextColumnComparer : IComparer
|
|
{
|
|
private int column;
|
|
SortOrder order;
|
|
|
|
public LviTextColumnComparer()
|
|
{
|
|
column = 0;
|
|
order = SortOrder.Ascending;
|
|
}
|
|
|
|
public LviTextColumnComparer(int column, SortOrder order)
|
|
{
|
|
this.column = column;
|
|
this.order = order;
|
|
}
|
|
|
|
public int Compare(object x, object y)
|
|
{
|
|
string txtX = ((ListViewItem)x).SubItems[column].Text;
|
|
string txtY = ((ListViewItem)y).SubItems[column].Text;
|
|
return (order == SortOrder.Descending) ? String.Compare(txtY, txtX) : String.Compare(txtX, txtY);
|
|
}
|
|
}
|
|
}
|