本文整理汇总了C#中IColor.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# IColor.GetType方法的具体用法?C# IColor.GetType怎么用?C# IColor.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IColor
的用法示例。
在下文中一共展示了IColor.GetType方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetNamesOfChannels
/// <summary>
/// Get the names of the channels
/// </summary>
/// <param name="color">The color</param>
/// <returns>The names of the channels</returns>
public static String[] GetNamesOfChannels(IColor color)
{
List<String> channelNames = new List<string>();
foreach (System.Reflection.PropertyInfo pInfo in color.GetType().GetProperties())
{
if (pInfo.GetCustomAttributes(typeof(DisplayColorAttribute), true).Length > 0)
channelNames.Add(pInfo.Name);
}
if (channelNames.Count > 0) return channelNames.ToArray();
//Create default channel names
String[] res = new string[color.Dimension];
for (int i = 0; i < res.Length; i++)
res[i] = String.Format("Channel {0}", i);
return res;
}
示例2: GetDisplayColorOfChannels
/// <summary>
/// Get the display color for each channel
/// </summary>
public static System.Drawing.Color[] GetDisplayColorOfChannels(IColor color)
{
List<System.Drawing.Color> channelColor = new List<System.Drawing.Color>();
foreach (System.Reflection.PropertyInfo pInfo in color.GetType().GetProperties())
{
Object[] displayAtts = pInfo.GetCustomAttributes(typeof(DisplayColorAttribute), true);
if (displayAtts.Length > 0)
channelColor.Add(((DisplayColorAttribute)displayAtts[0]).DisplayColor);
}
if (channelColor.Count > 0) return channelColor.ToArray();
//create default color
System.Drawing.Color[] res = new System.Drawing.Color[color.Dimension];
for (int i = 0; i < res.Length; i++)
res[i] = System.Drawing.Color.Gray;
return res;
}
示例3: GetDisplayColorOfChannels
/// <summary>
/// Get the display color for each channel
/// </summary>
/// <param name="color">The color</param>
/// <returns>The display color for each channel</returns>
public static Color[] GetDisplayColorOfChannels(IColor color)
{
List<Color> channelColor = new List<Color>();
foreach (System.Reflection.PropertyInfo pInfo in color.GetType().GetProperties())
{
object[] displayAtts = pInfo.GetCustomAttributes(typeof(DisplayColorAttribute), true);
if (displayAtts.Length > 0)
channelColor.Add(((DisplayColorAttribute)displayAtts[0]).DisplayColor);
}
if (channelColor.Count > 0) return channelColor.ToArray();
//create default color
Color[] res = new Color[color.Dimension];
for (int i = 0; i < res.Length; i++)
//res[i] = Color.FromArgb(255, 125, 125, 125);
#if ( UNITY_ANDROID || UNITY_IPHONE || UNITY_STANDALONE || UNITY_METRO )
res[i] = Color.gray;
#else
res[i] = Color.Gray;
#endif
return res;
}
示例4: GetAction
private static MethodInfo GetAction(IColor color, string actionName)
{
return color.GetType().GetMethod(actionName, BindingFlags.Public | BindingFlags.Instance);
}