當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。