当前位置: 首页>>代码示例>>C#>>正文


C# Color.Equals方法代码示例

本文整理汇总了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));
 }
开发者ID:roddy,项目名称:TEdit,代码行数:5,代码来源:Player.cs

示例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;
            }
        }
开发者ID:kse-jp,项目名称:RM-3000,代码行数:31,代码来源:ColorBackgroundDlg.xaml.cs

示例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));
 }
开发者ID:KristofferJasperi,项目名称:OthelloTDDD49,代码行数:5,代码来源:Field.cs

示例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;
        }
开发者ID:CalebRouleau,项目名称:friendlycheckers,代码行数:34,代码来源:GamePage.xaml.cs

示例5: HasColor

 public bool HasColor(Color color)
 {
     return color.Equals(_primary) || color.Equals(_secondary);
 }
开发者ID:gp-andino,项目名称:Guardianes-Greenpeace,代码行数:4,代码来源:MapCountry.cs

示例6: AdjustHighlightingColour

 private static void AdjustHighlightingColour(HighlightingColor current, Color desired)
 {
     if (!desired.Equals(current.Foreground.GetColor(_colourContext)))
     {
         current.Foreground = new CustomHighlightingBrush(desired);
     }
 }
开发者ID:almostEric,项目名称:DotNetRDF-4.0,代码行数:7,代码来源:SyntaxManager.cs

示例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
            }
        }
开发者ID:BillHuangg,项目名称:FloodFill,代码行数:44,代码来源:MainPageButtonEvent.cs

示例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;
        }
开发者ID:BillHuangg,项目名称:FloodFill,代码行数:24,代码来源:MainPage.xaml.cs

示例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;
     }
 }
开发者ID:BillHuangg,项目名称:FloodFill,代码行数:17,代码来源:MainPage.xaml.cs

示例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";
        }
开发者ID:340211173,项目名称:Windows-driver-samples,代码行数:44,代码来源:BidiHelper.cs

示例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 "";
        }
开发者ID:ehosca,项目名称:agTetribricks,代码行数:13,代码来源:MainPage.xaml.cs


注:本文中的System.Windows.Media.Color.Equals方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。