You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
1.3 KiB
37 lines
1.3 KiB
|
2 years ago
|
using System;
|
||
|
|
using System.Collections.Generic;
|
||
|
|
using System.Globalization;
|
||
|
|
using System.Linq;
|
||
|
|
using System.Text;
|
||
|
|
using System.Threading.Tasks;
|
||
|
|
|
||
|
|
namespace formula_manage.ConvertMoels
|
||
|
|
{
|
||
|
|
internal class ColorSQLConvert
|
||
|
|
{
|
||
|
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||
|
|
{
|
||
|
|
if (value != null)
|
||
|
|
{
|
||
|
|
string colorValue = string.Format("{0:X6}", value);//十进制RGB数值转十六进制六位RGB并补0位例“C0C0C0”
|
||
|
|
/*string StuffColor = "#FF" + colorValue;//RGB数值拼接为ARGB数值(正向)*/
|
||
|
|
string StuffColor_B = colorValue.Substring(0, 2);//获取蓝色参数
|
||
|
|
string StuffColor_G = colorValue.Substring(2, 2);//获取绿色参数
|
||
|
|
string StuffColor_R = colorValue.Substring(4, 2);//获取红色参数
|
||
|
|
string StuffColor = "#FF" + StuffColor_R + StuffColor_G + StuffColor_B;//RGB数值拼接为ARGB数值
|
||
|
|
return StuffColor;//返回RGB数值例“#FFC0C0C0”
|
||
|
|
}
|
||
|
|
else
|
||
|
|
{
|
||
|
|
return null;//返回空
|
||
|
|
}
|
||
|
|
}
|
||
|
|
/// <summary>
|
||
|
|
/// </summary>
|
||
|
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||
|
|
{
|
||
|
|
return null;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|