mirror of
https://github.com/vinaypamnani/wmie2.git
synced 2026-04-07 15:23:50 +00:00
Add project files.
This commit is contained in:
commit
041ea99c61
66 changed files with 16706 additions and 0 deletions
33
WmiExplorer/Classes/ToolStripItemCollectionSorter.cs
Normal file
33
WmiExplorer/Classes/ToolStripItemCollectionSorter.cs
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace WmiExplorer.Classes
|
||||
{
|
||||
public static class ToolStripItemExtensions
|
||||
{
|
||||
public static void SortToolStripItemCollection(this ToolStripItemCollection items)
|
||||
{
|
||||
ArrayList aList = new ArrayList(items);
|
||||
aList.Sort(new ToolStripItemCollectionSorter());
|
||||
items.Clear();
|
||||
|
||||
foreach (ToolStripItem item in aList)
|
||||
{
|
||||
items.Add(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class ToolStripItemCollectionSorter : IComparer
|
||||
{
|
||||
public int Compare(object x, object y)
|
||||
{
|
||||
// Cast the objects to be compared to ListViewItem objects
|
||||
ToolStripItem toolStripItemX = (ToolStripItem)x;
|
||||
ToolStripItem toolStripItemY = (ToolStripItem)y;
|
||||
|
||||
return String.Compare(toolStripItemX.Text, toolStripItemY.Text, StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue