本文整理汇总了C#中System.Windows.Media.Color.Equals方法的典型用法代码示例。如果您正苦于以下问题:C# Color.Equals方法的具体用法?C# Color.Equals怎么用?C# Color.Equals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Media.Color
的用法示例。
在下文中一共展示了Color.Equals方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: IsBothNullOrEqual
private static bool IsBothNullOrEqual(Color a, Color b)
{
return (a == null && b == null) ||
(a != null && b != null && a.Equals(b));
}
示例2: SeachColorCombo
/// <summary>
/// SeachColorCombo
/// </summary>
/// <param name="inpColor"></param>
/// <returns></returns>
private ComboBoxItem SeachColorCombo(ComboBox comboBox, Color inpColor)
{
try
{
ComboBoxItem outpitem = null;
foreach (ComboBoxItem cmbitem in comboBox.Items)
{
SolidColorBrush brush = cmbitem.Background as SolidColorBrush;
if (brush != null)
{
if (inpColor.Equals(brush.Color))
{
outpitem = cmbitem;
break;
}
}
}
return outpitem;
}
catch (Exception ex)
{
throw ex;
}
}
示例3: WasFlipped
private bool WasFlipped(Color old_color, Color new_color)
{
return (old_color.Equals(Colors.Black) && new_color.Equals(Colors.White)) ||
(old_color.Equals(Colors.White) && new_color.Equals(Colors.Black));
}
示例4: Checker
public Checker(int x, int y, Color color, Color bg)
{
el1 = new Ellipse();
el2 = new Ellipse();
crown = new Image();
BitmapImage bi = new BitmapImage();
bi.UriSource = new Uri("crown.png", UriKind.Relative);
crown.Source = bi;
crown.Visibility = Visibility.Collapsed;
crown.MouseLeftButtonUp += ellipse_MouseUp;
this.x = x;
this.y = y;
this.width = 55;
this.lit = false;
this.color = color;
this.col = (color.Equals(GamePage.DarkGrey) ? false : true);
this.bg = bg;
this.high = !col ? GamePage.HighlightGrey : GamePage.HighlightRed;
el1.Width = width;
el1.MinWidth = width;
el1.Height = width;
el1.MinHeight = width;
el1.Fill = new SolidColorBrush(color);
el2.Width = width;
el2.MinWidth = width;
el2.Height = width;
el2.MinHeight = width;
el2.Fill = new SolidColorBrush(bg);
el1.MouseLeftButtonUp += ellipse_MouseUp;
el2.MouseLeftButtonUp += ellipse_MouseUp;
}
示例5: HasColor
public bool HasColor(Color color)
{
return color.Equals(_primary) || color.Equals(_secondary);
}
示例6: AdjustHighlightingColour
private static void AdjustHighlightingColour(HighlightingColor current, Color desired)
{
if (!desired.Equals(current.Foreground.GetColor(_colourContext)))
{
current.Foreground = new CustomHighlightingBrush(desired);
}
}
示例7: FloodFillImage_GetMousePosition
private void FloodFillImage_GetMousePosition(object sender, MouseButtonEventArgs e)
{
Point mousePoint = e.GetPosition((Image)sender);
int index = GetPixelPosition((int)mousePoint.X, (int)mousePoint.Y);
Color clickPointColor = new Color();
clickPointColor.B = enhPixelData[index];
clickPointColor.G = enhPixelData[index + 1];
clickPointColor.R = enhPixelData[index + 2];
//tempColor.A = enhPixelData[index + 3];
if (!clickPointColor.Equals(highLightColor))
{
if (!isFirstCilck)
{
//恢复前一个点选区域的颜色
int newIndex = GetPixelPosition((int)lastMousePoint.X, (int)lastMousePoint.Y);
Color newColorOfLastPoint = new Color();
newColorOfLastPoint.B = enhPixelData[newIndex];
newColorOfLastPoint.G = enhPixelData[newIndex + 1];
newColorOfLastPoint.R = enhPixelData[newIndex + 2];
//
if (newColorOfLastPoint.Equals(highLightColor) || !newColorOfLastPoint.Equals(lastClickColor))
{
//恢复前一个点选区域的颜色
FillGray(lastMousePoint, lastColor);
}
}
//高亮目前区域颜色
FillGray(mousePoint, highLightColor);
lastMousePoint = mousePoint;
lastColor = clickPointColor;
isFirstCilck = false;
}
else
{
//nothing
}
}
示例8: CheckEdge
private bool CheckEdge(Point temp, Color color)
{
if ((temp.X < 0) || (temp.X >= ImageWidth) || (temp.Y < 0) || (temp.Y >= ImageHeight))
return false;
int index = GetPixelPosition((int)temp.X, (int)temp.Y);
Color tempColor = new Color();
tempColor.B = enhPixelData[index];
tempColor.G = enhPixelData[index + 1];
tempColor.R = enhPixelData[index + 2];
tempColor.A = enhPixelData[index + 3];
//if (tempColor.Equals(old))
//{
// return false;
//}
//else
if (!tempColor.Equals(borderColor))
{
return true;
}
else
return false;
}
示例9: canFillArea
//与背景色 以及其余可选色相同 即可填充
//与边框相同即不可填充 返回false
private bool canFillArea(Color current, Color old)
{
if (current.Equals(old))
{
return false;
}
else if (!current.Equals(borderColor))
{
return true;
}
else
{
return false;
}
}
示例10: CreateInkXPathQuery
/// <summary>
/// Create an XPath query that retrieves the ink level from a standard bidi response.
/// </summary>
/// <param name="color"></param>
/// <returns></returns>
private static string CreateInkXPathQuery(Color color)
{
string colorName = null;
if (color.Equals(Colors.Black))
{
colorName = "Black";
}
else if (color.Equals(Colors.Red))
{
colorName = "Red";
}
else if (color.Equals(Colors.Green))
{
colorName = "Green";
}
else if (color.Equals(Colors.Blue))
{
colorName = "Blue";
}
else if (color.Equals(Colors.Cyan))
{
colorName = "Cyan";
}
else if (color.Equals(Colors.Magenta))
{
colorName = "Magenta";
}
else if (color.Equals(Colors.Yellow))
{
colorName = "Yellow";
}
else
{
throw new ArgumentException("Unsupported color");
}
return "/bidi:Get/Query/Schema[@name='\\Printer.Consumables." + colorName + "Ink" + ":Level']/BIDI_INT";
}
示例11: GetColorName
private string GetColorName(Color color)
{
if (color.Equals(Colors.Yellow))
return "yellow";
if (color.Equals(Colors.Red))
return "red";
if (color.Equals(Colors.Blue))
return "blue";
if (color.Equals(Colors.Green))
return "green";
return "";
}