33 lines
864 B
C#
33 lines
864 B
C#
using System;
|
|
using System.Collections;
|
|
using System.Windows.Forms;
|
|
using Common;
|
|
|
|
namespace SharedDatabase.Forms
|
|
{
|
|
class LviTextColumnComparer : IComparer
|
|
{
|
|
private int column;
|
|
MySortOrder order;
|
|
|
|
public LviTextColumnComparer()
|
|
{
|
|
column = 0;
|
|
order = MySortOrder.Ascending;
|
|
}
|
|
|
|
public LviTextColumnComparer(int column, MySortOrder 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 == MySortOrder.Descending || order == MySortOrder.Descending2) ? String.Compare(txtY, txtX) : String.Compare(txtX, txtY);
|
|
}
|
|
}
|
|
}
|