本文整理汇总了C#中KnownColor类的典型用法代码示例。如果您正苦于以下问题:C# KnownColor类的具体用法?C# KnownColor怎么用?C# KnownColor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
KnownColor类属于命名空间,在下文中一共展示了KnownColor类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Color
private Color(long value, short state, string name, KnownColor knownColor)
{
_value = value;
_state = state;
_name = name;
_knownColor = (short)knownColor;
}
开发者ID:Taritsyn,项目名称:MsieJavaScriptEngine,代码行数:7,代码来源:Color.cs
示例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;
}
开发者ID:jigshGitHub,项目名称:CascadeDevelopment-VS2010,代码行数:26,代码来源:ColorCodeHelper.cs
示例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));
}
开发者ID:Kornel,项目名称:Astar,代码行数:28,代码来源:MainEngine.cs
示例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;
}
}
}
开发者ID:jigshGitHub,项目名称:SandlerTrainingDevelopment,代码行数:31,代码来源:ColorCode.ascx.cs
示例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);
}
开发者ID:PeterWaher,项目名称:RetroSharp,代码行数:14,代码来源:CharactersAttribute.cs
示例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;
}
开发者ID:valryon,项目名称:pixpuzzle,代码行数:8,代码来源:Color.cs
示例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);
}
开发者ID:PeterWaher,项目名称:RetroSharp,代码行数:17,代码来源:ScreenBorderAttribute.cs
示例8: KnownColorToArgb
public static int KnownColorToArgb(KnownColor color)
{
if (color == KnownColor.OrangeRed)
{
return -1286;
}
return 0;
}
开发者ID:Taritsyn,项目名称:JavaScriptEngineSwitcher,代码行数:9,代码来源:KnownColorTable.cs
示例9: KnownColorToName
public static string KnownColorToName(KnownColor color)
{
if (color == KnownColor.OrangeRed)
{
return "OrangeRed";
}
return null;
}
开发者ID:Taritsyn,项目名称:JavaScriptEngineSwitcher,代码行数:9,代码来源:KnownColorTable.cs
示例10: VotingStone
public VotingStone(int siteUID)
: base(4963)
{
SiteUID = siteUID;
UsageColor = KnownColor.SkyBlue;
Name = "Voting Stone";
LootType = LootType.Blessed;
Weight = 0;
}
开发者ID:Ravenwolfe,项目名称:Core,代码行数:10,代码来源:VoteStone.cs
示例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;
}
开发者ID:viticm,项目名称:pap2,代码行数:11,代码来源:Color.cs
示例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();
}
}
开发者ID:JonHoy,项目名称:Robotic_Arm,代码行数:11,代码来源:Class1.cs
示例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;
}
开发者ID:willcraftia,项目名称:WindowsGame,代码行数:13,代码来源:Vector3ColorEditor.cs
示例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;
}
开发者ID:phys-tech,项目名称:QuestMaker,代码行数:14,代码来源:CPerson.cs
示例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];
}
}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:19,代码来源:SystemPens.cs
示例16: GetOrCreateBrush
// Get or create a system brush.
private static Brush GetOrCreateBrush(KnownColor color)
{
lock(typeof(SystemBrushes))
{
if(systemBrushes == null)
{
systemBrushes = new Brush
[((int)(KnownColor.WindowText)) -
((int)(KnownColor.ActiveBorder)) + 1];
}
int index = ((int)color) - ((int)(KnownColor.ActiveBorder));
if(systemBrushes[index] == null)
{
systemBrushes[index]
= new SolidBrush(new Color(color));
}
return systemBrushes[index];
}
}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:20,代码来源:SystemBrushes.cs
示例17: GetOrCreateBrush
// Get or create a standard brush.
private static Brush GetOrCreateBrush(KnownColor color)
{
lock(typeof(Brushes))
{
if(standardBrushes == null)
{
standardBrushes = new Brush
[((int)(KnownColor.YellowGreen)) -
((int)(KnownColor.Transparent)) + 1];
}
int index = ((int)color) - ((int)(KnownColor.Transparent));
if(standardBrushes[index] == null)
{
standardBrushes[index]
= new SolidBrush(new Color(color));
}
return standardBrushes[index];
}
}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:20,代码来源:Brushes.cs
示例18: GetOrCreatePen
// Get or create a standard pen.
private static Pen GetOrCreatePen(KnownColor color)
{
lock(typeof(Pens))
{
if(standardPens == null)
{
standardPens = new Pen
[((int)(KnownColor.YellowGreen)) -
((int)(KnownColor.Transparent)) + 1];
}
int index = ((int)color) - ((int)(KnownColor.Transparent));
if(standardPens[index] == null)
{
standardPens[index]
= new Pen(new Color(color));
}
return standardPens[index];
}
}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:20,代码来源:Pens.cs
示例19: SheetFieldDef
public SheetFieldDef(SheetFieldType fieldType,string fieldName,string fieldValue,
float fontSize,string fontName,bool fontIsBold,
int xPos,int yPos,int width,int height,
GrowthBehaviorEnum growthBehavior,string radioButtonValue,bool isPaymentOption=false,KnownColor itemColor=KnownColor.Black,HorizontalAlignment textAlign=HorizontalAlignment.Left)
{
FieldType=fieldType;
FieldName=fieldName;
FieldValue=fieldValue;
FontSize=fontSize;
FontName=fontName;
FontIsBold=fontIsBold;
XPos=xPos;
YPos=yPos;
Width=width;
Height=height;
GrowthBehavior=growthBehavior;
RadioButtonValue=radioButtonValue;
IsPaymentOption=isPaymentOption;
ItemColor=Color.FromKnownColor(itemColor);
TextAlign=textAlign;
}
开发者ID:mnisl,项目名称:OD,代码行数:21,代码来源:SheetFieldDef.cs
示例20: SaveData
private bool SaveData()
{
if (saveFileDialog1.ShowDialog() != DialogResult.OK)
{
return false;
}
var colorsArray = Enum.GetValues(typeof(KnownColor));
var allColors = new KnownColor[colorsArray.Length];
Array.Copy(colorsArray, allColors, colorsArray.Length);
var startInd = Array.IndexOf(allColors, KnownColor.Black) + 1;
using (var file = File.CreateText(saveFileDialog1.FileName))
{
foreach (var pair in _chars)
{
file.WriteLine("{0}\0{1}\0{2}", pair.Key, pair.Value, allColors[startInd++]);
}
file.Close();
}
return true;
}
开发者ID:jorik041,项目名称:EgorkaGame,代码行数:22,代码来源:KeyLoggingForm.cs
注:本文中的KnownColor类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论