本文整理汇总了C#中Interval.Split方法的典型用法代码示例。如果您正苦于以下问题:C# Interval.Split方法的具体用法?C# Interval.Split怎么用?C# Interval.Split使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Interval
的用法示例。
在下文中一共展示了Interval.Split方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CountOf
/// <summary>
/// Returns count of occurrencies of given character in specified interval.
/// </summary>
/// <param name="i"></param>
/// <param name="c"></param>
/// <returns></returns>
private int CountOf(Interval i, char c)
{
int cnt=0;
Interval tmp, iNew;
Position pos;
while( (pos=IndexOf(c,i)) < i.End )
{
cnt++;
i.Split(pos, out tmp, out iNew);
iNew.Start++;
i=iNew;
}
return cnt;
}
示例2: MeasureIgnoringNewlines
/// <summary>
/// Measures text contained in given interval. Newline characters
/// are ignored and so it's measured as a long single line.
/// </summary>
/// <param name="gr"></param>
/// <param name="i"></param>
/// <returns></returns>
private SizeF MeasureIgnoringNewlines(Graphics gr, Interval i)
{
SizeF size=new SizeF(0, 0);
SizeF msz; //Measured size
Position nl;
Interval iOld, iNew;
while( (nl=IndexOf('\n', i)) <i.End )
{
i.Split(nl, out iOld, out iNew);
msz=Measure(gr,iOld,true);
size.Width+=msz.Width;
size.Height=Math.Max(size.Height, msz.Height);
iNew.Start++;
i=iNew;
}
msz=Measure(gr,i,true);
size.Width+=msz.Width;
size.Height=Math.Max(size.Height, msz.Height);
return size;
}