本文整理汇总了C#中System.Drawing.ColorConverter.ConvertToString方法的典型用法代码示例。如果您正苦于以下问题:C# ColorConverter.ConvertToString方法的具体用法?C# ColorConverter.ConvertToString怎么用?C# ColorConverter.ConvertToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Drawing.ColorConverter
的用法示例。
在下文中一共展示了ColorConverter.ConvertToString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ToString
private string ToString(object value)
{
var buttons = (ButtonsCaption)value; // Gelen object tipimizi ButtonsCaption tipine dönüştürüyoruz ve ayıklama işlemine başlıyoruz.
var converter = new ColorConverter();
return String.Format("{0}, {1}",
converter.ConvertToString(buttons.ActiveCaptionButtonsColor), converter.ConvertToString(buttons.InactiveCaptionButtonsColor));
}
示例2: ToString
private string ToString(object value)
{
var gradient = value as GradientTab; // Gelen object tipimizi GradientTab tipine dönüştürüyoruz ve ayıklama işlemine başlıyoruz.
var converter = new ColorConverter();
return String.Format("{0}, {1}, {2}, {3}, {4}, {5}",
converter.ConvertToString(gradient.ColorStart), converter.ConvertToString(gradient.ColorEnd), gradient.GradientStyle, converter.ConvertToString(gradient.TabPageTextColor), converter.ConvertToString(gradient.TabPageSelectedTextColor), gradient.SelectedTabFontStyle);
}
示例3: ConvertToString
/// <summary>
/// Convierte un valor a una cadena
/// </summary>
public new string ConvertToString(object objValue)
{ StyleBauControl objStyle = (StyleBauControl) objValue;
ColorConverter objConverter = new ColorConverter();
string strConvert;
// Obtiene la cadena formateada con los valores numéricos
strConvert = objStyle.RoundCorners.ToString() + ",";
strConvert = objStyle.AngleCorners.ToString() + ",";
strConvert += objStyle.ShadowThickness.ToString() + ",";
strConvert += objStyle.BorderWidth.ToString() + ",";
// Obtiene la cadena formateada con los colores
strConvert += objConverter.ConvertToString(objStyle.BorderColor) + ",";
strConvert += objConverter.ConvertToString(objStyle.BackgroundColor) + ",";
strConvert += objConverter.ConvertToString(objStyle.BackgroundGradientColor) + ",";
strConvert += objConverter.ConvertToString(objStyle.ShadowColor) + ",";
strConvert += objConverter.ConvertToString(objStyle.ForeColor) + ",";
// Obtiene la cadena formateada con el modo del gradiante
strConvert += ((int) objStyle.GradientMode).ToString();
// Devuelve la cadena
return strConvert;
}
示例4: Save
internal void Save(XmlWriter writer)
{
writer.WriteStartElement("fullScreenViewer");
ResizerConverter rsConv = new ResizerConverter();
writer.WriteStartElement("resizer");
writer.WriteAttributeString("value", (string)rsConv.ConvertTo(null, null, resizer, typeof(string)));
writer.WriteEndElement();
EnumConverter ipConv = new EnumConverter(typeof(InterpolationMode));
writer.WriteStartElement("interpolationMode");
writer.WriteAttributeString("value", ipConv.ConvertToString(interpolationMode));
writer.WriteEndElement();
ColorConverter colorConv = new ColorConverter();
writer.WriteStartElement("backColor");
writer.WriteAttributeString("value", colorConv.ConvertToString(backColor));
writer.WriteEndElement();
writer.WriteEndElement();
}
示例5: SaveProjectToolStripMenuItem_Click
public void SaveProjectToolStripMenuItem_Click(System.Object sender, System.EventArgs e)
{
save = "";
save = System.Convert.ToString(xn + "_" + yn + "_" + zn + "_" + agent + "_");
for (var i = 1; i <= agent; i++)
{
save = save + generator.Default.agentname[i] + "_";
}
for (var i = 1; i <= agent; i++)
{
save = save + generator.Default.agentcount[i] + "_";
}
for (var i = 1; i <= agent; i++)
{
save = save + generator.Default.initialenergy[i] + "_";
}
for (var i = 1; i <= agent; i++)
{
save = save + generator.Default.stepenergy[i] + "_";
}
for (var i = 1; i <= agent; i++)
{
save = save + generator.Default.bumpenergy[i] + "_";
}
for (var i = 1; i <= agent; i++)
{
save = save + generator.Default.aging[i] + "_";
}
for (var i = 1; i <= agent; i++)
{
save = save + generator.Default.agelimit[i] + "_";
}
for (var i = 1; i <= agent; i++)
{
save = save + generator.Default.asr[i] + "_";
}
for (var i = 1; i <= agent; i++)
{
save = save + generator.Default.asrtime[i] + "_";
}
for (var i = 1; i <= agent; i++)
{
save = save + generator.Default.asrenergy[i] + "_";
}
for (var i = 1; i <= agent; i++)
{
System.Drawing.ColorConverter colourconverter = new System.Drawing.ColorConverter();
save = save + colourconverter.ConvertToString(generator.Default.agentcolour[i]) + "_";
}
for (var i = 1; i <= agent; i++)
{
save = save + generator.Default.agentrangeabsolute[i] + "_";
}
for (var a = 1; a <= agent; a++)
{
for (var b = 0; b <= 2; b++)
{
for (var c = 0; c <= 1; c++)
{
save = save + generator.Default.agentrange[a, b, c] + "_";
}
}
}
for (var a = 1; a <= agent; a++)
{
for (var b = 1; b <= agent; b++)
{
for (var c = 1; c <= 6; c++)
{
save = save + generator.Default.action[a, b, c] + "_";
}
}
}
save = save + "|";
SaveFilepro.ShowDialog();
}
示例6: Save
internal void Save(XmlWriter writer)
{
writer.WriteStartElement("thumbnail");
SizeConverter sizeConv = new SizeConverter();
writer.WriteStartElement("size");
writer.WriteAttributeString("value", sizeConv.ConvertToString(size));
writer.WriteEndElement();
EnumConverter ipConv = new EnumConverter(typeof(InterpolationMode));
writer.WriteStartElement("interpolationMode");
writer.WriteAttributeString("value", ipConv.ConvertToString(interpolationMode));
writer.WriteEndElement();
ColorConverter colorConv = new ColorConverter();
writer.WriteStartElement("backColor");
writer.WriteAttributeString("value", colorConv.ConvertToString(backColor));
writer.WriteEndElement();
EnumConverter priorityConv = new EnumConverter(typeof(ThreadPriority));
writer.WriteStartElement("threadPriority");
writer.WriteAttributeString("value", priorityConv.ConvertToString(threadPriority));
writer.WriteEndElement();
writer.WriteEndElement();
}
示例7: ConvertToString_Name
public void ConvertToString_Name(string name)
{
var conv = new ColorConverter();
Assert.Equal(name, conv.ConvertToString(Color.FromName(name)));
}
示例8: ConvertTo
public override object ConvertTo(
ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
{
if (destinationType == typeof(string))
{
BackColorBlend cb = value as BackColorBlend;
if (cb != null)
{
ColorConverter cvt = new ColorConverter();
if (cb.Colors != null)
{
if (cb.Colors[0] != Color.Empty)
return (cvt.ConvertToString(cb.Colors[0]));
if (cb.Colors.Length > 1 && cb.Colors[1] != Color.Empty)
return (cvt.ConvertToString(cb.Colors[1]));
}
}
return (String.Empty);
}
return (base.ConvertTo(context, culture, value, destinationType));
}
示例9: ToString
private string ToString(object value)
{
TooltipRenderer tRenderer = value as TooltipRenderer;
TypeConverter converter = new ColorConverter();
return String.Format("{0}, {1}, {2}, {3}, {4}, {5}, {6}, {7}, {8}, {9}, {10}",
converter.ConvertToString(tRenderer.BorderColor),
converter.ConvertToString(tRenderer.TitleForeColor),
converter.ConvertToString(tRenderer.MessageForeColor),
converter.ConvertToString(tRenderer.LightBackgroundColor),
converter.ConvertToString(tRenderer.DarkBackgroundColor),
tRenderer.Radius,
converter.ConvertToString(tRenderer.BarBorderColor),
converter.ConvertToString(tRenderer.BarBackgroundColorStart),
converter.ConvertToString(tRenderer.BarBackgroundColorEnd),
converter.ConvertToString(tRenderer.BarProgressColorStart),
converter.ConvertToString(tRenderer.BarProgressColorEnd));
}
示例10: ToString
private string ToString(object value)
{
GradientFill fill = (GradientFill)value;
ColorConverter converter = new ColorConverter();
return String.Format("{0}, {1}, {2}", converter.ConvertToString(fill.ColorA), converter.ConvertToString(fill.ColorB), fill.GradientFillStyle.ToString());
}
示例11: SetColor
public void SetColor(string key, Color color)
{
ColorConverter fc = new ColorConverter();
_htSettings[key] = fc.ConvertToString(color);
}
示例12: ToString
private string ToString(object value)
{
CaptionGradient gradient = value as CaptionGradient; // Gelen object tipimizi CaptionGradient tipine dönüştürüyoruz ve ayıklama işlemine başlıyoruz.
ColorConverter converter = new ColorConverter();
return String.Format("{0}, {1}, {2}, {3}, {4}, {5}, {6}, {7}",
converter.ConvertToString(gradient.ActiveCaptionColorStart), converter.ConvertToString(gradient.ActiveCaptionColorEnd),
converter.ConvertToString(gradient.InactiveCaptionColorStart), converter.ConvertToString(gradient.InactiveCaptionColorEnd), gradient.CaptionGradientStyle,
converter.ConvertToString(gradient.InactiveCaptionTextColor), converter.ConvertToString(gradient.ActiveCaptionTextColor), gradient.ActiveCaptionFontStyle);
}
示例13: ConvertTo
public override object ConvertTo(ITypeDescriptorContext context,
System.Globalization.CultureInfo culture, object value, Type destinationType)
{
//将对象转换为字符串:"Black,1"
if (destinationType == typeof(string))
{
TabControlBorderStyle style = value as TabControlBorderStyle;
TypeConverter converter = new ColorConverter();
return string.Format("{0},{1}", converter.ConvertToString(style.Color), style.Width.ToString());
}
return base.ConvertTo(context, culture, value, destinationType);
}
示例14: ConvertTo
public override object ConvertTo(
ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
{
if (destinationType == typeof(string))
{
Background gc = value as Background;
if (gc != null)
{
if (gc.BackColorBlend != null && gc.BackColorBlend.IsEmpty == false)
return ("Blended");
ColorConverter cvt = new ColorConverter();
string s = gc.Color1.IsEmpty ? "(Empty)" : cvt.ConvertToString(gc.Color1);
if (gc.Color2 != Color.Empty)
s += ", " + cvt.ConvertToString(gc.Color2);
return (s);
}
}
return (base.ConvertTo(context, culture, value, destinationType));
}
示例15: ConvertToString
public void ConvertToString(int a, int r, int g, int b)
{
var conv = new ColorConverter();
var str = conv.ConvertToString(Color.FromArgb(a, r, g, b));
Assert.Equal(string.Format("{0}{4} {1}{4} {2}{4} {3}", a, r, g, b, CultureInfo.CurrentCulture.TextInfo.ListSeparator), str);
}