📄 comboitem.cs
字号:
using System;
using System.Collections;
using System.Windows.Forms;
namespace WorkFlow.util
{
/// <summary>
/// ComboItem 的摘要说明。
/// </summary>
public class ComboItem
{
private string name;
private int ivalue;
private string strvalue = null;
public ComboItem(string name, int ivalue)
{
//
// TODO: 在此处添加构造函数逻辑
//
this.name=name;
this.ivalue=ivalue;
}
public ComboItem(String name,string strvalue)
{
this.name = name;
this.strvalue = strvalue;
}
public string Name
{
get{ return name; }
}
public int Value
{
get { return ivalue; }
}
public string StrValue
{
get { return strvalue; }
}
public override string ToString()
{
return this.name;
}
public static ComboItem[] HashToComboItem(Hashtable hash)
{
try
{
ComboItem[] comboItems = new ComboItem[hash.Count];
string[] keys = new string[hash.Count];
IEnumerator ie = hash.Keys.GetEnumerator();
int index = 0;
while (ie.MoveNext())
{
keys[index] = ie.Current.ToString();
index++;
}
for (int i=0;i<keys.Length;i++)
{
for (int j=i+1;j<keys.Length;j++)
{
if (keys[i].CompareTo(keys[j]) > 0)
{
string tmp = keys[i];
keys[i] = keys[j];
keys[j] = tmp;
}
}
}
for (int i=0;i<keys.Length;i++)
{
int ivalue = int.Parse(keys[i]);
string name = hash[keys[i]].ToString();
comboItems[i] = new ComboItem(name,ivalue);
}
return comboItems;
}
catch (Exception)
{
return null;
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -