本文整理汇总了C#中ColorType.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# ColorType.ToString方法的具体用法?C# ColorType.ToString怎么用?C# ColorType.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ColorType
的用法示例。
在下文中一共展示了ColorType.ToString方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ReadColor
MyHighlightingColor ReadColor(XElement color, ref ColorType colorType)
{
var name = color.Attribute("name");
if (name == null)
return null;
colorType = ToColorType(name.Value);
if (colorType == ColorType.Last)
return null;
var colorInfo = colorInfos[(int)colorType];
var hl = new MyHighlightingColor();
hl.Name = colorType.ToString();
var fg = GetAttribute(color, "fg", colorInfo.DefaultForeground);
if (fg != null)
hl.Foreground = CreateColor(fg);
var bg = GetAttribute(color, "bg", colorInfo.DefaultBackground);
if (bg != null)
hl.Background = CreateColor(bg);
var color3 = GetAttribute(color, "color3", colorInfo.DefaultColor3);
if (color3 != null)
hl.Color3 = CreateColor(color3);
var color4 = GetAttribute(color, "color4", colorInfo.DefaultColor4);
if (color4 != null)
hl.Color4 = CreateColor(color4);
var italics = color.Attribute("italics") ?? color.Attribute("italic");
if (italics != null)
hl.FontStyle = (bool)italics ? FontStyles.Italic : FontStyles.Normal;
var bold = color.Attribute("bold");
if (bold != null)
hl.FontWeight = (bool)bold ? FontWeights.Bold : FontWeights.Normal;
return hl;
}
示例2: CreateHighlightingColor
MyHighlightingColor CreateHighlightingColor(ColorType colorType)
{
var hl = new MyHighlightingColor { Name = colorType.ToString() };
var colorInfo = colorInfos[(int)colorType];
if (colorInfo.DefaultForeground != null)
hl.Foreground = CreateColor(colorInfo.DefaultForeground);
if (colorInfo.DefaultBackground != null)
hl.Background = CreateColor(colorInfo.DefaultBackground);
if (colorInfo.DefaultColor3 != null)
hl.Color3 = CreateColor(colorInfo.DefaultColor3);
if (colorInfo.DefaultColor4 != null)
hl.Color4 = CreateColor(colorInfo.DefaultColor4);
return hl;
}
示例3: CreateThemeColor
ThemeColor CreateThemeColor(ColorType colorType) {
var hl = new ThemeColor { Name = colorType.ToString() };
var colorInfo = colorInfos[ToIndex(colorType)];
if (colorInfo.DefaultForeground != null)
hl.Foreground = CreateColor(colorInfo.DefaultForeground);
if (colorInfo.DefaultBackground != null)
hl.Background = CreateColor(colorInfo.DefaultBackground);
if (colorInfo.DefaultColor3 != null)
hl.Color3 = CreateColor(colorInfo.DefaultColor3);
if (colorInfo.DefaultColor4 != null)
hl.Color4 = CreateColor(colorInfo.DefaultColor4);
return hl;
}