ImageGear23.Windows.Forms Assembly > ImageGear.Windows.Forms.Thumbnails Namespace > IImGearThumbnailCtl Interface : SortComparer Property |
'Declaration Property SortComparer As IComparer
'Usage Dim instance As IImGearThumbnailCtl Dim value As IComparer instance.SortComparer = value value = instance.SortComparer
IComparer SortComparer {get; set;}
__property IComparer* get_SortComparer(); __property void set_SortComparer( IComparer* value );
property IComparer^ SortComparer { IComparer^ get(); void set ( IComparer^ value); }
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()