当前位置: 首页>>代码示例>>C#>>正文


C# ColorConverter.ConvertToInvariantString方法代码示例

本文整理汇总了C#中System.Drawing.ColorConverter.ConvertToInvariantString方法的典型用法代码示例。如果您正苦于以下问题:C# ColorConverter.ConvertToInvariantString方法的具体用法?C# ColorConverter.ConvertToInvariantString怎么用?C# ColorConverter.ConvertToInvariantString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Drawing.ColorConverter的用法示例。


在下文中一共展示了ColorConverter.ConvertToInvariantString方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ConvertToInvariantString_Name

 public void ConvertToInvariantString_Name(string name)
 {
     var conv = new ColorConverter();
     Assert.Equal(name, conv.ConvertToInvariantString(Color.FromName(name)));
 }
开发者ID:geoffkizer,项目名称:corefx,代码行数:5,代码来源:ColorConverterTests.cs

示例2: ConvertToInvariantString

 public void ConvertToInvariantString(int a, int r, int g, int b)
 {
     var conv = new ColorConverter();
     var str = conv.ConvertToInvariantString(Color.FromArgb(a, r, g, b));
     Assert.Equal($"{a}, {r}, {g}, {b}", str);
 }
开发者ID:geoffkizer,项目名称:corefx,代码行数:6,代码来源:ColorConverterTests.cs

示例3: typeof

    ConvertTo
    (
        ITypeDescriptorContext context,
        CultureInfo culture,
        Object value,
        Type destinationType
    )
    {
        Debug.Assert(value != null);
        Debug.Assert(value is ColorColumnAutoFillUserSettings);
        Debug.Assert( destinationType == typeof(String) );
        AssertValid();

        ColorColumnAutoFillUserSettings oColorColumnAutoFillUserSettings =
            (ColorColumnAutoFillUserSettings)value;

        ColorConverter oColorConverter = new ColorConverter();

        // Use a simple tab-delimited format.  Sample string:
        //
        // "false\tfalse\t0\t10\tRed\tGreen\tfalse\tfalse\ttrue"
        //
        // WARNING: If this format is changed, you must also change the
        // DefaultSettingValueAttribute for each property in the
        // AutoFillUserSettings class that is of type
        // ColorColumnAutoFillUserSettings.

        return ( String.Format(CultureInfo.InvariantCulture,

            "{0}\t{1}\t{2}\t{3}\t{4}\t{5}\t{6}\t{7}\t{8}"
            ,
            oColorColumnAutoFillUserSettings.UseSourceNumber1,
            oColorColumnAutoFillUserSettings.UseSourceNumber2,
            oColorColumnAutoFillUserSettings.SourceNumber1,
            oColorColumnAutoFillUserSettings.SourceNumber2,

            oColorConverter.ConvertToInvariantString(
                oColorColumnAutoFillUserSettings.DestinationColor1),

            oColorConverter.ConvertToInvariantString(
                oColorColumnAutoFillUserSettings.DestinationColor2),

            oColorColumnAutoFillUserSettings.IgnoreOutliers,
            oColorColumnAutoFillUserSettings.UseLogs,
            oColorColumnAutoFillUserSettings.SourceColumnContainsNumbers
            ) );
    }
开发者ID:2014-sed-team3,项目名称:term-project,代码行数:47,代码来源:ColorColumnAutoFillUserSettings.cs

示例4: ConvertToString

    ConvertToString()
    {
        AssertValid();

        ColorConverter oColorConverter = new ColorConverter();

        String [] asCategoryNames = (m_oCategoryNames == null) ?
            new String [0] : m_oCategoryNames.ToArray();

        return ( String.Join(PerWorkbookSettings.FieldSeparatorString,

            new String [] {
                base.ConvertToString(),

                ( new System.ComponentModel.BooleanConverter() ).
                    ConvertToInvariantString(m_bSourceColumnContainsNumbers),

                oColorConverter.ConvertToInvariantString(
                    m_oDestinationColor1),

                oColorConverter.ConvertToInvariantString(
                    m_oDestinationColor2),

                String.Join(PerWorkbookSettings.SubFieldSeparatorString,
                    asCategoryNames)
            } ) );
    }
开发者ID:2014-sed-team3,项目名称:term-project,代码行数:27,代码来源:AutoFillColorColumnResults.cs

示例5: typeof

    ConvertTo
    (
        ITypeDescriptorContext context,
        CultureInfo culture,
        Object value,
        Type destinationType
    )
    {
        Debug.Assert(value != null);
        Debug.Assert(value is LabelUserSettings);
        Debug.Assert( destinationType == typeof(String) );
        AssertValid();

        LabelUserSettings oLabelUserSettings = (LabelUserSettings)value;

        // Use a simple tab-delimited format.  Note that newer settings have
        // been added to the end, so related settings are not all contiguous.
        // Sample string:
        //
        // "Microsoft Sans Serif, 8.25pt\tWhite\tBottomCenter\t2147483647\t
        // 4294967295\tBlack\ttrue\t200\tBlack\t86\tMiddleCenter";

        ColorConverter oColorConverter = new ColorConverter();

        return ( String.Format(CultureInfo.InvariantCulture,

            "{0}\t{1}\t{2}\t{3}\t{4}\t{5}\t{6}\t{7}\t{8}\t{9}\t{10}"
            ,
            ( new FontConverter() ).ConvertToInvariantString(
                oLabelUserSettings.Font),

            oColorConverter.ConvertToInvariantString(
                oLabelUserSettings.VertexLabelFillColor),

            oLabelUserSettings.VertexLabelPosition,
            oLabelUserSettings.VertexLabelMaximumLength,
            oLabelUserSettings.EdgeLabelMaximumLength,

            oColorConverter.ConvertToInvariantString(
                oLabelUserSettings.EdgeLabelTextColor),

            oLabelUserSettings.VertexLabelWrapText,
            oLabelUserSettings.VertexLabelWrapMaxTextWidth,

            oColorConverter.ConvertToInvariantString(
                oLabelUserSettings.GroupLabelTextColor),

            oLabelUserSettings.GroupLabelTextAlpha,
            oLabelUserSettings.GroupLabelPosition
            ) );
    }
开发者ID:2014-sed-team3,项目名称:term-project,代码行数:51,代码来源:LabelUserSettings.cs

示例6: ColorConverter

        /// <summary>
        /// Converts an object into its XML representation.
        /// </summary>
        /// <param name="writer">The <see cref="T:System.Xml.XmlWriter"/> stream to which the object is serialized.</param>
        void IXmlSerializable.WriteXml(System.Xml.XmlWriter writer)
        {
            ColorConverter conv = new ColorConverter();

            writer.WriteElementString("TextColor", conv.ConvertToInvariantString(TextColor));
            writer.WriteElementString("BackColor", conv.ConvertToInvariantString(BackColor));
            writer.WriteElementString("DisplayMode", DisplayMode.ToString("G"));
            writer.WriteElementString("BlinkTimeSeparator", BlinkTimeSeparator.ToString());
            writer.WriteElementString("UseUpperCase", UseUpperCase.ToString());
        }
开发者ID:bornste,项目名称:TimeSaver,代码行数:14,代码来源:Settings.cs


注:本文中的System.Drawing.ColorConverter.ConvertToInvariantString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。