我主要是想由颜色值得到ARGB值。就在其他C#项目中写了个函数。


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;
}
}
}
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;
}
}
}
用在这里:borderRoomName.Background = new SolidColorBrush(Color.FromArgb(255, 10, 36, 106));
参考:http://space.cnblogs.com/question/15170/