颜色值转换,比如"#EE22FF"如果转换为Color.FromArgb(0,0,0,0);这四个整数。

 
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using System.Drawing;

namespace HCLoad.Web
{
    public partial class _Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            Response.Write(getARGB("#0a246a"));
        }
        private string getARGB(string strColor)
        {
            Color col = ColorTranslator.FromHtml(strColor);
            int alpha = col.A;
            int red = col.R;
            int green = col.G;
            int blue = col.B;
            //Color bColor = Color.FromArgb(alpha, red, green, blue);
            return alpha + "," + red + "," + green + "," + blue;
        }
    }
}

你可能感兴趣的:(String,object,Class)