|
- using System;
- using System.Collections.Generic;
- using System.Globalization;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Data;
- using System.Windows.Media;
-
- namespace BPASmartClient.CustomResource.Converters
- {
- public class ColorLightConverter : IValueConverter
- {
- public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
- {
- Color color = (Color)value;
- int degree = 40;
- bool flag = parameter != null;
- if (flag)
- {
- degree = System.Convert.ToInt32(parameter);
- }
- return Color.FromRgb((byte)((int)color.R + (int)(byte.MaxValue - color.R) * degree / 100), (byte)((int)color.G + (int)(byte.MaxValue - color.G) * degree / 100), (byte)((int)color.B + (int)(byte.MaxValue - color.B) * degree / 100));
- }
-
- public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
- {
- return value;
- }
- }
- }
|