當前位置: 首頁>>代碼示例>>C#>>正文


C# Color.ToString方法代碼示例

本文整理匯總了C#中System.Color.ToString方法的典型用法代碼示例。如果您正苦於以下問題:C# Color.ToString方法的具體用法?C# Color.ToString怎麽用?C# Color.ToString使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.Color的用法示例。


在下文中一共展示了Color.ToString方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: OnBoardChangedComet

 protected async void OnBoardChangedComet(int x, int y, Type type, Color side)
 {
     await SendMessage(
         "{\"success\": true, \"actions\": [" +
             "{\"action\": \"update-board\", \"param\":" +
                 String.Format("[{{\"type\": \"{0}\", \"side\": \"{1}\", \"x\": {2}, \"y\": {3}}}]", type.ToString(), side.ToString(), x, y) +
             "}" +
         "]}");
 }
開發者ID:Martin1994,項目名稱:pp9k,代碼行數:9,代碼來源:ChloroCometGame.cs

示例2: Color_Premultiply

 public void Color_Premultiply()
 {
     Color c = new Color(128,128,128,true);
     Assert.AreEqual(c.R, 128);
     Assert.AreEqual(c.G, 128);
     Assert.AreEqual(c.B, 128);
     Assert.AreEqual(c.A, 255);
     Assert.IsTrue(c.Premultiplied);
     Assert.AreEqual(c.ToString(), "rgb(128,128,128)");
 }
開發者ID:rouen-sk,項目名稱:NET-Mapnik,代碼行數:10,代碼來源:ColorTest.cs

示例3: WeCanParseTheOutputOfToString

        public void WeCanParseTheOutputOfToString()
        {
            Color c = new Color(0.5f, 0.5f, 0.5f);
            Color c1 = Color.Parse(c.ToString());

            Assert.That(c1.R, Is.EqualTo(c.R));
            Assert.That(c1.G, Is.EqualTo(c.G));
            Assert.That(c1.B, Is.EqualTo(c.B));
            Assert.That(c1.A, Is.EqualTo(c.A));
        }
開發者ID:Joelone,項目名稱:FFWD,代碼行數:10,代碼來源:WhenConvertingAColor.cs

示例4: MyRemotePlayer

 public MyRemotePlayer(string dllName, Color color)
 {
     process = new Process();
     process.StartInfo.FileName = "Checkers.Runner.exe";
     process.StartInfo.Arguments = dllName + " " + color.ToString();
     process.StartInfo.UseShellExecute = false;
     process.StartInfo.RedirectStandardInput = true;
     process.StartInfo.RedirectStandardOutput = true;
     process.StartInfo.CreateNoWindow = false;
     process.Start();
 }
開發者ID:BandW404,項目名稱:checkers,代碼行數:11,代碼來源:MyRemotePlayer.cs

示例5: Color_FromRGBAPercent

 public void Color_FromRGBAPercent()
 {
     Color c = new Color("rgba(100%,0%,0%,1)");
     Assert.AreEqual(c.R, 255);
     Assert.AreEqual(c.G, 0);
     Assert.AreEqual(c.B, 0);
     Assert.AreEqual(c.A, 255);
     Assert.AreEqual(c.Hex(), "#ff0000");
     Assert.IsFalse(c.Premultiplied);
     Assert.AreEqual(c.ToString(), "rgb(255,0,0)");
 }
開發者ID:rouen-sk,項目名稱:NET-Mapnik,代碼行數:11,代碼來源:ColorTest.cs

示例6: Color_FromText

 public void Color_FromText()
 {
     Color c = new Color("red");
     Assert.AreEqual(c.R, 255);
     Assert.AreEqual(c.G, 0);
     Assert.AreEqual(c.B, 0);
     Assert.AreEqual(c.A, 255);
     Assert.IsFalse(c.Premultiplied);
     Assert.AreEqual(c.Hex(), "#ff0000");
     Assert.AreEqual(c.ToString(), "rgb(255,0,0)");
 }
開發者ID:rouen-sk,項目名稱:NET-Mapnik,代碼行數:11,代碼來源:ColorTest.cs

示例7: Auto

 public string color;//Цвет
 //Конструктор по умолчанию - цена, производитель и цвет
 public Auto(int price, Manufacturer manuf, Color col)
 {
     this.price = price;
     this.manufacturer = manuf.ToString();
     this.color = col.ToString();
 }
開發者ID:GarageInc,項目名稱:all,代碼行數:8,代碼來源:Program.cs

示例8: GetImagePath

 private string GetImagePath(Color color)
 {
     return @"/Content/imgs/" + color.ToString() + "Ninja.png";
 }
開發者ID:Shkembe-Chorba-Team,項目名稱:JustWars,代碼行數:4,代碼來源:Register.aspx.cs

示例9: VerifyingPixelColor

        /// <summary>
        /// Gets the pixel color and verifies 
        /// </summary>      
        /// <returns></returns>
        protected MFTestResults VerifyingPixelColor(Point[] pts, Color _color)
        {
            for (int i = 0; i < pts.Length; i++)
            {
                Color c = Master_Presentation.mainWindow._pBitmap.GetPixel(pts[i].x, pts[i].y);
                if (c != _color)
                {
                    Thread.Sleep(1000);

                    c = Master_Presentation.mainWindow._pBitmap.GetPixel(pts[i].x, pts[i].y);

                    if(_color != c)
                    {
                        Master_Presentation.mainWindow._pBitmap.DrawEllipse(c == Colors.Red ? Colors.Green : Colors.Red, 1, pts[i].x, pts[i].y, 3, 3, (Color)0, 0, 0, (Color)0, 0, 0, Bitmap.OpacityTransparent);
                        Master_Presentation.mainWindow._pBitmap.Flush();

                        Log.Comment("Failure : Expected color '" + _color.ToString() + "' but got '" +
                            c.ToString() + "' at (" + pts[i].x.ToString() + ", " + pts[i].y.ToString() + ")");
                        return MFTestResults.Fail;
                    }
                }
            }
            return MFTestResults.Pass;
        }
開發者ID:aura1213,項目名稱:netmf-interpreter,代碼行數:28,代碼來源:Master.cs

示例10: Color_ToString_Test

 public void Color_ToString_Test()
 {
     var color = new Color(0.0f, 0.1f, 0.22f, 0.333f);
     Assert.AreEqual("Color(0, 0.1, 0.22, 0.333)", color.ToString());
 }
開發者ID:HaKDMoDz,項目名稱:Irelia,代碼行數:5,代碼來源:ColorTest.cs

示例11: Display

 private void Display(Mode m, Color c, State s, Types t) {
     string mstr = m.ToString();
     string cstr = c.ToString();
     string sstr = s.ToString();
     string tstr = t.ToString();
 }
開發者ID:fugaku,項目名稱:scriptsharp,代碼行數:6,代碼來源:Code1.cs

示例12: SetCondition

        //////////////////////////////////////////////////////////////////////////////////////////////////////////
        /*                                                               CONDITION MANAGEMENT                                                                */
        //////////////////////////////////////////////////////////////////////////////////////////////////////////
        void SetCondition(string _condition)
        {
            condition = _condition;
            StoreExternalConfigData();
            Debug("New Condition: [" + _condition + "]");
            Debug("Switching Lights: " + lights.Count);

            Color lcdBGColor = new Color(0, 0, 0);
            Color fontColor = new Color(255, 255, 255);
            Color lightColor = new Color(255, 255, 255);
            Debug("Switch to condition: " + _condition);
            switch (_condition)
            {
                case "green":
                    lcdBGColor = panelDefaultBG;
                    fontColor = panelDefaultFC;
                    for (int i = 0; i < lights.Count; i++)
                    {
                        string _name = lights[i].CustomName;
                        Color color = LIGHT_CONFIGURATION[lights[i]];
                        lights[i].SetValue("Color", color);
                        Debug("OLD COLOR WAS:" + color.ToString());
                    }
                    VALUE_CONDITION = "green";
                    break;
                case "orange":
                    lcdBGColor = conditionOrangeBG;
                    fontColor = conditionOrangeFC;
                    lightColor = conditionOrangeLight;
                    for (int i = 0; i < lights.Count; i++)
                    {
                        lights[i].SetValue("Color", lightColor);
                    }
                    VALUE_CONDITION = "orange";
                    break;
                case "red":
                    Debug("Switching Lights to condition red");
                    lcdBGColor = conditionRedBG;
                    fontColor = conditionRedFC;
                    lightColor = conditionRedLight;
                    Debug("Switching Lights:" + lightColor.ToString());

                    for (int i = 0; i < lights.Count; i++)
                    {
                        lights[i].SetValue("Color", lightColor);
                    }
                    VALUE_CONDITION = "red";
                    break;
                default:
                    lcdBGColor = panelDefaultBG;
                    fontColor = panelDefaultFC;
                    break;
            }
            Debug("SETTING COLOR");
            for (int i = 0; i < panels.Count; i++)
            {
                panels[i].SetValue("BackgroundColor", lcdBGColor);
                panels[i].SetValue("FontColor", fontColor);
            }
            RUNNING_CONFIGURATION[KEY_CONDITION] = VALUE_CONDITION;
            StoreExternalConfigData();
        }
開發者ID:cccdemon,項目名稱:space-engineers-sios,代碼行數:65,代碼來源:Coresystem.cs

示例13: VerifyingPixelColor

        /// <summary>
        /// Gets the pixel color and verifies 
        /// </summary>      
        /// <returns></returns>
        protected MFTestResults VerifyingPixelColor(Point[] pts, Color _color)
        {
            MFTestResults tResult = MFTestResults.Pass;
            for (int i = 0; i < pts.Length; i++)
            {
                if ((pts[i].x >= Master_Media._panel._pBitmap.Width) ||
                   (pts[i].y >= Master_Media._panel._pBitmap.Height))
                {
                    continue;
                }

                Color c = Master_Media._panel._pBitmap.GetPixel(pts[i].x, pts[i].y);
                if (c != _color)
                {
                    // this method could fail because of a race condition between renderign and this thread
                    // wait a bit
                    Thread.Sleep(2000);

                    // get the color again
                    c = Master_Media._panel._pBitmap.GetPixel(pts[i].x, pts[i].y);
                    if (c != _color)
                    {
                        Master_Media._panel._pBitmap.DrawEllipse(Colors.Red, 1, pts[i].x, pts[i].y, 3, 3, Colors.White, 0, 0, Color.White, 3, 3, Bitmap.OpacityOpaque);
                        Master_Media._panel._pBitmap.Flush();

                        Log.Comment("Failure : Expected color '" + _color.ToString() + "' but got '" +
                            c.ToString() + "' at (" + pts[i].x.ToString() + ", " + pts[i].y.ToString() + ")");
                        tResult = MFTestResults.Fail;
                    }
                }               
            }
            return tResult;
        }
開發者ID:koson,項目名稱:.NETMF_for_LPC17xx,代碼行數:37,代碼來源:Master.cs

示例14: TestToString

		public void TestToString ()
		{
			var color = new Color (1, 1, 1, 0.5);
			Assert.AreEqual ("[Color: A=0.5, R=1, G=1, B=1, Hue=0, Saturation=0, Luminosity=1]", color.ToString ());
		}
開發者ID:Costo,項目名稱:Xamarin.Forms,代碼行數:5,代碼來源:ColorUnitTests.cs

示例15: OnTurnChangedComet

 protected async void OnTurnChangedComet(Color side)
 {
     await SendMessage(
         "{\"success\": true, \"actions\": [" +
             "{\"action\": \"update-turn\", \"param\": \"" + side.ToString() + "\"}" +
         "]}");
 }
開發者ID:Martin1994,項目名稱:pp9k,代碼行數:7,代碼來源:ChloroCometGame.cs


注:本文中的System.Color.ToString方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。