32 lines
820 B
C#
32 lines
820 B
C#
using System;
|
|
using System.Collections;
|
|
using System.Windows.Forms;
|
|
|
|
namespace Users.Forms
|
|
{
|
|
class LviIntColumnComparer : IComparer
|
|
{
|
|
int column;
|
|
MySortOrder order;
|
|
|
|
public LviIntColumnComparer()
|
|
{
|
|
column = 0;
|
|
order = MySortOrder.Ascending;
|
|
}
|
|
|
|
public LviIntColumnComparer(int column, MySortOrder 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 == MySortOrder.Descending || order == MySortOrder.Descending2) ? (valY - valX) : (valX - valY);
|
|
}
|
|
}
|
|
}
|