public class CustomComparer : IComparer
{
public int Compare(Object a, Object b)
{
IImGearThumbnailItem item1 = (IImGearThumbnailItem)a;
IImGearThumbnailItem item2 = (IImGearThumbnailItem)b;
if (item1.Page.DIB.Height < item2.Page.DIB.Height)
{
return -1;
}
else if (item1.Page.DIB.Height > item2.Page.DIB.Height)
{
return 1;
}
else // equal
{
return 0;
}
}
}
// usage
// .. in InitializeComponent
this.thumbnailCtl.Sort = ImageGear.Windows.Forms.Thumbnails.ImGearSortOptions.UserSort;
this.thumbnailCtl.SortComparer = new CustomComparer();
Public Class CustomComparer
Implements IComparer
Public Function Compare(a As [Object], b As [Object]) As Integer
Dim item1 As IImGearThumbnailItem = DirectCast(a, IImGearThumbnailItem)
Dim item2 As IImGearThumbnailItem = DirectCast(b, IImGearThumbnailItem)
If item1.Page.DIB.Height < item2.Page.DIB.Height Then
Return -1
ElseIf item1.Page.DIB.Height > item2.Page.DIB.Height Then
Return 1
Else
' equal
Return 0
End If
End Function
End Class
' usage
' in InitializeComponent
Me.thumbnailCtl.Sort = ImageGear.Windows.Forms.Thumbnails.ImGearSortOptions.UserSort
Me.thumbnailCtl.SortComparer = New CustomComparer()