//System.Math.Cos(33);
//Type theMathType = Type.GetType("System.Math");
//Type[] parameterTypes = new Type[1];
//parameterTypes[0] = Type.GetType("System.Double");
//MethodInfo CosinInfo = theMathType.GetMethod("Cos", parameterTypes);
//Object[] parameters = new Object[1];
//parameters[0] = 45;
//Object result = CosinInfo.Invoke(null, parameters);
//Console.WriteLine(result.ToString());
/*
Type BstrType = typeof(ButtonImages);
FieldInfo finfo = BstrType.GetField("Btn_" + text);
string img = finfo.GetValue(null) as string;
*/
{
public static string ImgBasePath = " ~/Images/site/Buttons/ " ;
private const string Pattern = " " ;
private const string PatternMethod = " " ;
#region
///
/// Btn-bc.gif
///
public static string Btn_bc = string .Format(Pattern, " Btn-bc.gif " );
///
/// Btn-bcdd.gif
///
public static string Btn_bcdd = string .Format(Pattern, " Btn-bcdd.gif " );
///
/// Btn-bj.gif
///
public static string Btn_bj = string .Format(Pattern, " Btn-bj.gif " );
///
/// Btn-cfdd.gif
///
public static string Btn_cfdd = string .Format(Pattern, " Btn-cfdd.gif " );
///
/// Btn-cjcgry.gif
///
public static string Btn_cjcgry = string .Format(Pattern, " Btn-cjcgry.gif " );
///
/// Btn-cjjtgly.gif
///
public static string Btn_cjjtgly = string .Format(Pattern, " Btn-cjjtgly.gif " );
///
/// Btn-cjxsry.gif
///
public static string Btn_cjxsry = string .Format(Pattern, " Btn-cjxsry.gif " );
///
/// Btn-ck.gif
///
public static string Btn_ck = string .Format(Pattern, " Btn-ck.gif " );
///
/// Btn-DownArrow.gif
///
public static string Btn_DownArrow = string .Format(Pattern, " Btn-DownArrow.gif " );
///
/// Btn-drdd.gif
///
public static string Btn_drdd = string .Format(Pattern, " Btn-drdd.gif " );
///
/// Btn-fb.gif
///
public static string Btn_fb = string .Format(Pattern, " Btn-fb.gif " );
///
/// Btn-fbgszx.gif
///
public static string Btn_fbgszx = string .Format(Pattern, " Btn-fbgszx.gif " );
///
/// Btn-fbxcpxx.gif
///
public static string Btn_fbxcpxx = string .Format(Pattern, " Btn-fbxcpxx.gif " );
///
/// Btn-fh.gif
///
public static string Btn_fh = string .Format(Pattern, " Btn-fh.gif " );
///
/// Btn-fk.gif
///
public static string Btn_fk = string .Format(Pattern, " Btn-fk.gif " );
///
/// Btn-fsly.gif
///
public static string Btn_fsly = string .Format(Pattern, " Btn-fsly.gif " );
///
/// Btn-fszgys.gif
///
public static string Btn_fszgys = string .Format(Pattern, " Btn-fszgys.gif " );
///
/// Btn-gl.gif
///
public static string Btn_gl = string .Format(Pattern, " Btn-gl.gif " );
///
/// Btn-gx.gif
///
public static string Btn_gx = string .Format(Pattern, " Btn-gx.gif " );
///
/// Btn-gxsl.gif
///
public static string Btn_gxsl = string .Format(Pattern, " Btn-gxsl.gif " );
///
/// Btn-hbsxdd.gif
///
public static string Btn_hbsxdd = string .Format(Pattern, " Btn-hbsxdd.gif " );
///
/// Btn-hf.gif
///
public static string Btn_hf = string .Format(Pattern, " Btn-hf.gif " );
///
/// Btn-jj.gif
///
public static string Btn_jj = string .Format(Pattern, " Btn-jj.gif " );
///
/// Btn-jy.gif
///
public static string Btn_jy = string .Format(Pattern, " Btn-jy.gif " );
///
/// Btn-ll.gif
///
public static string Btn_ll = string .Format(Pattern, " Btn-ll.gif " );
///
/// Btn-psfs.gif
///
public static string Btn_psfs = string .Format(Pattern, " Btn-psfs.gif " );
///
/// Btn-qd.gif
///
public static string Btn_qd = string .Format(Pattern, " Btn-qd.gif " );
///
/// Btn-qr.gif
///
public static string Btn_qr = string .Format(Pattern, " Btn-qr.gif " );
///
/// Btn-qrdd.gif
///
public static string Btn_qrdd = string .Format(Pattern, " Btn-qrdd.gif " );
///
/// Btn-qrwwtj.gif
///
public static string Btn_qrwwtj = string .Format(Pattern, " Btn-qrwwtj.gif " );
///
/// Btn-qx.gif
///
public static string Btn_qx = string .Format(Pattern, " Btn-qx.gif " );
///
/// Btn-qy.gif
///
public static string Btn_qy = string .Format(Pattern, " Btn-qy.gif " );
///
/// Btn-sc.gif
///
public static string Btn_sc = string .Format(Pattern, " Btn-sc.gif " );
///
/// Btn-scsxdd.gif
///
public static string Btn_scsxdd = string .Format(Pattern, " Btn-scsxdd.gif " );
///
/// Btn-scxz.gif
///
public static string Btn_scxz = string .Format(Pattern, " Btn-scxz.gif " );
///
/// Btn-sqrz.gif
///
public static string Btn_sqrz = string .Format(Pattern, " Btn-sqrz.gif " );
///
/// Btn-syb.gif
///
public static string Btn_syb = string .Format(Pattern, " Btn-syb.gif " );
///
/// Btn-syy.gif
///
public static string Btn_syy = string .Format(Pattern, " Btn-syy.gif " );
///
/// Btn-tg.gif
///
public static string Btn_tg = string .Format(Pattern, " Btn-tg.gif " );
///
/// Btn-tijiao.gif
///
public static string Btn_tijiao = string .Format(Pattern, " Btn-tijiao.gif " );
///
/// Btn-tj.gif
///
public static string Btn_tj = string .Format(Pattern, " Btn-tj.gif " );
///
/// Btn-tjbbc.gif
///
public static string Btn_tjbbc = string .Format(Pattern, " Btn-tjbbc.gif " );
///
/// Btn-tjdd.gif
///
public static string Btn_tjdd = string .Format(Pattern, " Btn-tjdd.gif " );
///
/// Btn-wfk.gif
///
public static string Btn_wfk = string .Format(Pattern, " Btn-wfk.gif " );
///
/// Btn-wqr.gif
///
public static string Btn_wqr = string .Format(Pattern, " Btn-wqr.gif " );
///
/// Btn-xg.gif
///
public static string Btn_xg = string .Format(Pattern, " Btn-xg.gif " );
///
/// Btn-xyb.gif
///
public static string Btn_xyb = string .Format(Pattern, " Btn-xyb.gif " );
///
/// Btn-xyy.gif
///
public static string Btn_xyy = string .Format(Pattern, " Btn-xyy.gif " );
///
/// Btn-yc.gif
///
public static string Btn_yc = string .Format(Pattern, " Btn-yc.gif " );
///
/// Btn-yfk.gif
///
public static string Btn_yfk = string .Format(Pattern, " Btn-yfk.gif " );
///
/// Btn-zffs.gif
///
public static string Btn_zffs = string .Format(Pattern, " Btn-zffs.gif " );
#endregion
public static string ResolveBtnImg( string text)
{
// text = GetPYString(text);
// System.Math.Cos(33);
// Type theMathType = Type.GetType("System.Math");
// Type[] parameterTypes = new Type[1];
// parameterTypes[0] = Type.GetType("System.Double");
// MethodInfo CosinInfo = theMathType.GetMethod("Cos", parameterTypes);
// Object[] parameters = new Object[1];
// parameters[0] = 45;
// Object result = CosinInfo.Invoke(null, parameters);
// Console.WriteLine(result.ToString());
/*
Type BstrType = typeof(ButtonImages);
FieldInfo finfo = BstrType.GetField("Btn_" + text);
string img = finfo.GetValue(null) as string;
*/
string py = GetPYString(text);
return string .Format(PatternMethod, " Btn- " + py + " .gif " ,text);
}
///
/// 汉字转拼音缩写
///
/// 要转换的汉字字符串
///
private static string GetPYString( string str)
{
string tempStr = "" ;
foreach ( char c in str)
{
if (( int )c >= 33 && ( int )c <= 126 )
{ // 字母和符号原样保留
tempStr += c.ToString();
}
else
{ // 累加拼音声母
tempStr += GetPYChar(c.ToString());
}
}
return tempStr;
}
///
/// 取单个字符的拼音声母
///
/// 要转换的单个汉字
///
private static string GetPYChar( string c)
{
byte [] array = new byte [ 2 ];
array = System.Text.Encoding.Default.GetBytes(c);
int i = ( short )(array[ 0 ] - ' \0 ' ) * 256 + (( short )(array[ 1 ] - ' \0 ' ));
if (i < 0xB0A1 ) return " * " ;
if (i < 0xB0C5 ) return " a " ;
if (i < 0xB2C1 ) return " b " ;
if (i < 0xB4EE ) return " c " ;
if (i < 0xB6EA ) return " d " ;
if (i < 0xB7A2 ) return " e " ;
if (i < 0xB8C1 ) return " f " ;
if (i < 0xB9FE ) return " g " ;
if (i < 0xBBF7 ) return " h " ;
if (i < 0xBFA6 ) return " g " ;
if (i < 0xC0AC ) return " k " ;
if (i < 0xC2E8 ) return " l " ;
if (i < 0xC4C3 ) return " m " ;
if (i < 0xC5B6 ) return " n " ;
if (i < 0xC5BE ) return " o " ;
if (i < 0xC6DA ) return " p " ;
if (i < 0xC8BB ) return " q " ;
if (i < 0xC8F6 ) return " r " ;
if (i < 0xCBFA ) return " s " ;
if (i < 0xCDDA ) return " t " ;
if (i < 0xCEF4 ) return " w " ;
if (i < 0xD1B9 ) return " x " ;
if (i < 0xD4D1 ) return " y " ;
if (i < 0xD7FA ) return " z " ;
return " * " ;
}
}