本文整理汇总了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) +
"}" +
"]}");
}
示例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)");
}
示例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));
}
示例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();
}
示例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)");
}
示例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)");
}
示例7: Auto
public string color;//Цвет
//Конструктор по умолчанию - цена, производитель и цвет
public Auto(int price, Manufacturer manuf, Color col)
{
this.price = price;
this.manufacturer = manuf.ToString();
this.color = col.ToString();
}
示例8: GetImagePath
private string GetImagePath(Color color)
{
return @"/Content/imgs/" + color.ToString() + "Ninja.png";
}
示例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;
}
示例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());
}
示例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();
}
示例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();
}
示例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;
}
示例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 ());
}
示例15: OnTurnChangedComet
protected async void OnTurnChangedComet(Color side)
{
await SendMessage(
"{\"success\": true, \"actions\": [" +
"{\"action\": \"update-turn\", \"param\": \"" + side.ToString() + "\"}" +
"]}");
}