protected virtual void ShowSortIndicator(OLVColumn columnToSort, SortOrder sortOrder)
{
int imageIndex = -1;
if (!NativeMethods.HasBuiltinSortIndicators()) {
// If we can't use builtin image, we have to make and then locate the index of the
// sort indicator we want to use. SortOrder.None doesn't show an image.
if (this.SmallImageList == null || !this.SmallImageList.Images.ContainsKey(SORT_INDICATOR_UP_KEY))
MakeSortIndicatorImages();
imageIndex = this.SmallImageList.Images.IndexOfKey(sortOrder == SortOrder.Ascending ? SORT_INDICATOR_UP_KEY : SORT_INDICATOR_DOWN_KEY);
}
// Set the image for each column
for (int i = 0; i < this.Columns.Count; i++) {
if (columnToSort != null && i == columnToSort.Index)
NativeMethods.SetColumnImage(this, i, sortOrder, imageIndex);
else
NativeMethods.SetColumnImage(this, i, SortOrder.None, -1);
}
}