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


C# KnownColor.ToString方法代码示例

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


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

示例1: FromKnownName

		/// <summary>
		/// 根据颜色名获得对应的笔刷
		/// </summary>
		/// <param name="colorName"></param>
		/// <returns></returns>
		public static Brush FromKnownName(KnownColor colorName)
		{
			Brush brush;

			if (!_brushes.TryGetValue(colorName, out brush))
			{
				lock (_lockKey)
				{
					if (!_brushes.TryGetValue(colorName, out brush))
					{
						var type = typeof (Brushes);
						var p = type.GetProperty(colorName.ToString(), BindingFlags.Static | BindingFlags.Public);
						if (p != null)
						{
							brush = (Brush)p.GetValue(null, null);
						}

						_brushes.Add(colorName, brush);
					}
				}
			}

			return brush;
		}
开发者ID:FranKie-Ming,项目名称:FSLib.Extension,代码行数:29,代码来源:BrushUtility.cs

示例2: FromKnownColor

 /// <include file='doc\Color.uex' path='docs/doc[@for="Color.FromKnownColor"]/*' />
 /// <devdoc>
 ///    <para>
 ///       Creates a <see cref='System.Drawing.Color'/> from the specified <see cref='System.Drawing.KnownColor'/> .
 ///    </para>
 /// </devdoc>
 public static Color FromKnownColor(KnownColor color) {
     if( !ClientUtils.IsEnumValid( color, unchecked((int) color), (int) KnownColor.ActiveBorder, (int) KnownColor.MenuHighlight ) ) {
         return Color.FromName(color.ToString());
     }
     return new Color(color);
 }
开发者ID:mind0n,项目名称:hive,代码行数:12,代码来源:Color.cs

示例3: FromKnownColor

		public static Color FromKnownColor (KnownColor kc)
		{
			Color c;
			short n = (short)kc;
			if ((n <= 0) || (n >= ArgbValues.Length)) {
				// This is what it returns!
				c = Color.FromArgb (0, 0, 0, 0);
#if ONLY_1_1
				c.name = kc.ToString ();
#endif
				c.state |= (short) Color.ColorType.Named;
			} else {
				c = new Color ();
				c.state = (short) (Color.ColorType.ARGB | Color.ColorType.Known | Color.ColorType.Named);
				if ((n < 27) || (n > 169))
					c.state |= (short) Color.ColorType.System;
				c.Value = ArgbValues [n];
#if ONLY_1_1
				c.name = GetName (n);
#endif
			}
			c.knownColor = n;
			return c;
		}
开发者ID:LevNNN,项目名称:mono,代码行数:24,代码来源:KnownColors.cs

示例4: FromKnownColor

 public static Color FromKnownColor(KnownColor color)
 {
     var value = (int)color;
     if (value < (int)KnownColor.ActiveBorder || value > (int)KnownColor.MenuHighlight)
     {
         return Color.FromName(color.ToString());
     }
     return new Color(color);
 }
开发者ID:Corillian,项目名称:corefx,代码行数:9,代码来源:Color.cs

示例5: DisplayText

 public void DisplayText(string txt, KnownColor col = KnownColor.Black, bool force= false)
 {
     if (DisableLog_checkBox.Checked && !force)
     {
         return;
     }
     // intermediate step to get the invoke... work with calls with one or two parameters
     AppCol = Color.FromName(col.ToString());
     DisplayTxt(txt);
 }
开发者ID:mrandt,项目名称:LitePlacer-DEV,代码行数:10,代码来源:MainForm.cs

示例6: Compare

		private void Compare (KnownColor kc, GetSysColorIndex index)
		{
			// we get BGR than needs to be converted into ARGB
			Color sc = ColorTranslator.FromWin32 ((int)GDIPlus.Win32GetSysColor (index));
			Assert.AreEqual (Color.FromKnownColor (kc).ToArgb (), sc.ToArgb (), kc.ToString ());
		}
开发者ID:GirlD,项目名称:mono,代码行数:6,代码来源:TestColor.cs

示例7: FromKnownColor

        public static Color FromKnownColor(KnownColor c)
        {
			if (c < KnownColor.ActiveBorder || c > KnownColor.MenuHighlight) {

                // This is what it returns!
                Color d = new Color(0, 0, 0, 0);

                d.myname = c.ToString();
                d.colorType |= ColorType.Named;
                d.knownColor = c;

                return d;
            }

           object color =  typeof(Colors).InvokeMember(c.ToString(), System.Reflection.BindingFlags.Static |
                 System.Reflection.BindingFlags.GetProperty| System.Reflection.BindingFlags.Public, null, null, null);

           return (Color)color;
        }
开发者ID:viticm,项目名称:pap2,代码行数:19,代码来源:Color.cs

示例8: FromKnownColor

		public static Color FromKnownColor (KnownColor kc) {
			int n = (int) kc;
			if ((n <= 0) || (n >= Values.Length)) {
				// This is what it returns!
				Color c = Color.FromArgb (0, 0, 0, 0);
				c.name = kc.ToString ();
				c.state |= (short) Color.ColorType.Named;
				c.knownColor = (short) kc;
				return c;
			}
			return Values [n];
		}
开发者ID:carrie901,项目名称:mono,代码行数:12,代码来源:KnownColors.jvm.cs

示例9: FromKnownColor

		/// <summary>Creates a <see cref="T:System.Drawing.Color" /> structure from the specified predefined color.</summary>
		/// <returns>The <see cref="T:System.Drawing.Color" /> that this method creates.</returns>
		/// <param name="color">An element of the <see cref="T:System.Drawing.KnownColor" /> enumeration. </param>
		/// <filterpriority>1</filterpriority>
		public static Color FromKnownColor(KnownColor color)
		{
			if (!(color >= (KnownColor)1 && color <= (KnownColor)174))
			{
				return Color.FromName(color.ToString());
			}
			return new Color(color);
		}
开发者ID:antiufo,项目名称:Shaman.System.Drawing,代码行数:12,代码来源:Color.cs

示例10: FromKnownColor

 public static Color FromKnownColor(KnownColor color)
 {
     if (!System.Drawing.ClientUtils.IsEnumValid(color, (int) color, 1, 0xae))
     {
         return FromName(color.ToString());
     }
     return new Color(color);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:8,代码来源:Color.cs


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