本文整理汇总了C#中Run.IndexOf方法的典型用法代码示例。如果您正苦于以下问题:C# Run.IndexOf方法的具体用法?C# Run.IndexOf怎么用?C# Run.IndexOf使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Run
的用法示例。
在下文中一共展示了Run.IndexOf方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetDiffColor
private Color GetDiffColor(Run run, Split split, Func<Split, int?> differenceFunction)
{
int splitIndex = run.IndexOf(split);
int? diff = differenceFunction(split);
if (split.IsBest())
return BEST_TEXT_COLOR;
if (diff == 0)
return EVEN_TEXT_COLOR;
if (splitIndex == 0 || !ADVANCED_COMPARISON)
{
if (diff <= 0)
return AHEAD_GAIN_TEXT_COLOR;
else
return BEHIND_LOSS_TEXT_COLOR;
}
else
{
int? previousDiff = differenceFunction(run[splitIndex - 1]);
if (diff > 0)
{
if (diff >= previousDiff)
return BEHIND_LOSS_TEXT_COLOR;
if (diff < previousDiff)
return BEHIND_GAIN_TEXT_COLOR;
}
else
{
if (diff <= previousDiff)
return AHEAD_GAIN_TEXT_COLOR;
if (diff > previousDiff)
return AHEAD_LOSS_TEXT_COLOR;
}
}
throw new Exception();
}