本文整理汇总了C#中KnownColor类的典型用法代码示例。如果您正苦于以下问题:C# KnownColor类的具体用法?C# KnownColor怎么用?C# KnownColor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
KnownColor类属于命名空间,在下文中一共展示了KnownColor类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Color
private Color(long value, short state, string name, KnownColor knownColor)
{
_value = value;
_state = state;
_name = name;
_knownColor = (short)knownColor;
}
示例2: GetColorCodes
public static List<string> GetColorCodes()
{
KnownColor enumColor = new KnownColor();
Array Colors = Enum.GetValues(enumColor.GetType());
Color knownColor;
string hexColor;
List<string> colorCodes = null;
try
{
colorCodes = new List<string>();
foreach (object clr in Colors)
{
if (!Color.FromKnownColor((KnownColor)clr).IsSystemColor)
{
knownColor = ColorTranslator.FromHtml(clr.ToString());
hexColor = String.Format("{0:X2}{1:X2}{2:X2}", knownColor.R, knownColor.G, knownColor.B);
colorCodes.Add(hexColor);
}
}
}
catch (Exception ex)
{
throw new Exception("Error in ColorCodeHelper.GetColorCodes:" + ex.Message);
}
return colorCodes;
}
示例3: MainEngine
public MainEngine()
{
uiContext = new UI.Context(6, 200, 100);
Random random = new Random();
System.Array colorsArray = Enum.GetValues(typeof(KnownColor));
KnownColor[] allColors = new KnownColor[colorsArray.Length];
Array.Copy(colorsArray, allColors, colorsArray.Length);
int total = 2;
for (int i = 0; i < total; ++i)
{
Color randomColor1 = Color.FromKnownColor(allColors[random.Next(0, allColors.Length)]);
Color randomColor2 = Color.FromKnownColor(allColors[random.Next(0, allColors.Length)]);
Color randomColor3 = Color.FromKnownColor(allColors[random.Next(0, allColors.Length)]);
Brush pathBrush = new SolidBrush(randomColor1);
Brush playerBrush = pathBrush;
Brush startBrush = new SolidBrush(randomColor2);
Brush goalBrush = new SolidBrush(randomColor3);
players.Add(new Person(uiContext, pathBrush, playerBrush, startBrush, goalBrush));
}
//players.Add(new Person(uiContext, Brushes.CornflowerBlue, Brushes.CornflowerBlue, Brushes.LightBlue, Brushes.Blue));
//players.Add(new Person(uiContext, Brushes.Red, Brushes.Red, Brushes.LightCoral, Brushes.DarkRed));
//players.Add(new Person(uiContext, Brushes.Gold, Brushes.Gold, Brushes.Orange, Brushes.DarkOrange));
}
示例4: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
KnownColor enumColor = new KnownColor();
Array Colors = Enum.GetValues(enumColor.GetType());
ArrayList ALColor = new ArrayList();
Color knownColor;
string hexColor;
ListItem item;
try
{
foreach (object clr in Colors)
{
if (!Color.FromKnownColor((KnownColor)clr).IsSystemColor)
{
knownColor = ColorTranslator.FromHtml(clr.ToString());
hexColor = String.Format("{0:X2}{1:X2}{2:X2}", knownColor.R, knownColor.G, knownColor.B);
item = new ListItem(clr.ToString(), hexColor);
item.Attributes.Add("style", "color:#" + hexColor);
drpLstColorCodes.Items.Add(item);
ALColor.Add(clr.ToString());
}
}
}
catch (Exception ex)
{
throw ex;
}
}
}
示例5: CharactersAttribute
/// <summary>
/// Defines the number of characters available in a character-based screen.
/// </summary>
/// <param name="Width">Width of default screen, in tiles or characters.</param>
/// <param name="Height">Height of default screen, in tiles or characters.</param>
/// <param name="ForegroundColor">Foreground color of characters.</param>
/// <param name="ForegroundColor">Background color of characters.</param>
public CharactersAttribute(int Width, int Height, KnownColor ForegroundColor, KnownColor BackgroundColor)
{
this.width = AssertPositive(Width);
this.height = AssertPositive(Height);
this.foregroundColor = Color.FromKnownColor(ForegroundColor);
this.backgroundColor = Color.FromKnownColor(BackgroundColor);
}
示例6: FromArgbNamed
internal static Color FromArgbNamed (int alpha, int red, int green, int blue, string name, KnownColor knownColor)
{
Color color = FromArgb (alpha, red, green, blue);
color.state = (short) (ColorType.Known|ColorType.Named);
color.name = KnownColors.GetName (knownColor);
color.knownColor = (short) knownColor;
return color;
}
示例7: ScreenBorderAttribute
/// <summary>
/// Defines the default border size of the screen. If used in conjunction with <see cref="AspectRatioAttribute"/>,
/// these values defines the minimum border used. The attribute can also be used to define the border color.
/// </summary>
/// <param name="Left">Margin to the left of the screen.</param>
/// <param name="Right">Margin to the right of the screen.</param>
/// <param name="Top">Margon above the screen.</param>
/// <param name="Bottom">Margon below the screen.</param>
/// <param name="BorderColor">Border color.</param>
public ScreenBorderAttribute(int Left, int Right, int Top, int Bottom, KnownColor BorderColor)
{
this.leftMargin = AssertNonNegative(Left);
this.rightMargin = AssertNonNegative(Right);
this.topMargin = AssertNonNegative(Top);
this.bottomMargin = AssertNonNegative(Bottom);
this.borderColor = Color.FromKnownColor(BorderColor);
}
示例8: KnownColorToArgb
public static int KnownColorToArgb(KnownColor color)
{
if (color == KnownColor.OrangeRed)
{
return -1286;
}
return 0;
}
示例9: KnownColorToName
public static string KnownColorToName(KnownColor color)
{
if (color == KnownColor.OrangeRed)
{
return "OrangeRed";
}
return null;
}
示例10: VotingStone
public VotingStone(int siteUID)
: base(4963)
{
SiteUID = siteUID;
UsageColor = KnownColor.SkyBlue;
Name = "Voting Stone";
LootType = LootType.Blessed;
Weight = 0;
}
示例11: FromArgbNamed
internal static Color FromArgbNamed(int alpha, int red, int green, int blue, string name, KnownColor knownColor)
{
Color color = new Color(alpha, red, green, blue);
color.colorType = ColorType.Known | ColorType.Named;
//color.issystemcolor = false; //???
color.myname = name;
// FIXME: here happens SEGFAULT.
//color.knownColor = (KnownColor) Enum.Parse (typeof (KnownColor), name, false);
color.knownColor = knownColor;
return color;
}
示例12: ColorClassification
public ColorClassification()
{
System.Array colorsArray = Enum.GetValues(typeof(KnownColor));
KnownColor[] allColors = new KnownColor[colorsArray.Length];
Array.Copy(colorsArray, allColors, colorsArray.Length);
string[] colornames = new string[allColors.Length];
for (int iColor = 0; iColor < allColors.Length; iColor++)
{
colornames[iColor] = allColors[iColor].ToString();
}
}
示例13: ResolveKnownColor
void ResolveKnownColor(ref DrawingColor color, KnownColor start, KnownColor end, out DrawingColor? result)
{
for (KnownColor i = start; i <= end; i++)
{
var colorFromKnownColor = DrawingColor.FromKnownColor(i);
if (color.ToArgb() == colorFromKnownColor.ToArgb())
{
result = colorFromKnownColor;
return;
}
}
result = null;
}
示例14: CPerson
public CPerson(int _id, string _name, Sex _sex, string _description, bool _unremovable, string _comment,
List<int> _itemsList, List<int> _aimsList, KnownColor _clan, string _altName = "")
{
id = _id;
name = _name;
sex = _sex;
description = _description;
unremovable = _unremovable;
comment = _comment;
itemsId = _itemsList;
aimsId = _aimsList;
clan = _clan;
altName = _altName;
}
示例15: GetOrCreatePen
// Get or create a system pen.
private static Pen GetOrCreatePen(KnownColor color)
{
lock(typeof(SystemPens))
{
if(systemPens == null)
{
systemPens = new Pen
[((int)(KnownColor.WindowText)) -
((int)(KnownColor.ActiveBorder)) + 1];
}
int index = ((int)color) - ((int)(KnownColor.ActiveBorder));
if(systemPens[index] == null)
{
systemPens[index] = new Pen(new Color(color));
}
return systemPens[index];
}
}