标题添加重要,最新,滞后图标

需要在列表栏中的新闻标题添加重要,最新,  滞后图标,做了如下处理

public static string getImg(object p, object t)
        {
            try
            {
                string img = "";
                int p_int = Convert.ToInt32(p.ToString());

             //0 为重要 1最新 滞后通过DateTime.Compare来比较得出来的
                if (p_int == 0)
                    img += "&nbsp;<img src='\\Images\\TaskImg\\zyrw.gif' title='重要' width=14 height=14 style='vertical-align: bottom;'>";

               if (p_int == 1)
                    img += "&nbsp;<img src='\\Images\\TaskImg\\new.gif' title='最新' width=14 height=14 style='vertical-align: bottom;'>";

                DateTime t_date = Convert.ToDateTime(t);
                if (DateTime.Compare(Convert.ToDateTime(DateTime.Now.ToShortDateString()), t_date) > 0)
                    img += "&nbsp;<img src='\\Images\\TaskImg\\zhrw.gif' title='滞后' width=14 height=14 style='vertical-align: bottom;'>";

                return img;
            }
            catch
            {
                return "";
            }
        }

你可能感兴趣的:(图标)