ImageGear .NET - Updated
SortComparer Property (ImGearThumbnailCtl)
Example 




ImageGear24.Windows.Forms Assembly > ImageGear.Windows.Forms.Thumbnails Namespace > ImGearThumbnailCtl Class : SortComparer Property
Gets or sets IComparer used when Sort property is set to UserSort. You should provide a class implementing IComparer interface for custom sorting.
Syntax
'Declaration
 
<BrowsableAttribute(False)>
<DescriptionAttribute()>
Public Property SortComparer As IComparer
'Usage
 
Dim instance As ImGearThumbnailCtl
Dim value As IComparer
 
instance.SortComparer = value
 
value = instance.SortComparer
[Browsable(false)]
[Description()]
public IComparer SortComparer {get; set;}
[Browsable(false)]
[Description()]
public: __property IComparer* get_SortComparer();
public: __property void set_SortComparer( 
   IComparer* value
);
[Browsable(false)]
[Description()]
public:
property IComparer^ SortComparer {
   IComparer^ get();
   void set (    IComparer^ value);
}

Property Value

System.Collections.IComparer class object.
Example
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()
See Also

Reference

ImGearThumbnailCtl Class
ImGearThumbnailCtl Members