當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。