本文整理汇总了C#中System.Drawing.PointF.Any方法的典型用法代码示例。如果您正苦于以下问题:C# PointF.Any方法的具体用法?C# PointF.Any怎么用?C# PointF.Any使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Drawing.PointF
的用法示例。
在下文中一共展示了PointF.Any方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DrawDays
public void DrawDays(Graphics graphics, RectangleF outer, RectangleF inner, PointF[] points)
{
if (!points.Any()) throw new ArgumentException();
var brush = GetSolidBrush(LineColor);
var textBrush = GetSolidBrush(Color);
var font = GetFont("Arial", 12);
var oldest = GetOldestMondaiResult();
var newest = GetNewestMondaiResult();
var height = outer.Bottom - inner.Bottom;
// var oldestRectangle = new RectangleF(outer.Left, inner.Bottom, 100f, height);
var oldestRectangle = new RectangleF(points.Last().X, inner.Bottom, 100f, height);
var newestRectangle = new RectangleF(points.First().X, inner.Bottom, 100f, height);
var stringFormat = new StringFormat()
{
Alignment = StringAlignment.Near,
LineAlignment = StringAlignment.Near,
};
// 現在時刻からの最古の日数と最新の日数を表示。最新の日数は最古の日数と被らない限り表示する。
// var d0 = MondaiResult.GetStringFromTimeSpan(EPuzzleTime.Now - oldest.StartTime);
var d0 = (EPuzzleTime.Now - oldest.StartTime).GetShortString();
var size0 = MeasureString(d0, font);
// oldestRectangle.X -= size0.Width / 2f;
var r0 = new RectangleF(oldestRectangle.Left, oldestRectangle.Top, size0.Width, size0.Height);
graphics.DrawString(d0, font, textBrush, oldestRectangle, stringFormat);
// var d1 = MondaiResult.GetStringFromTimeSpan(EPuzzleTime.Now - newest.StartTime);
var d1 = (EPuzzleTime.Now - newest.StartTime).GetShortString();
var size1 = MeasureString(d1, font);
newestRectangle.X -= size1.Width / 2f;
var r1 = new RectangleF(newestRectangle.Left, newestRectangle.Top, size1.Width, size1.Height);
if (!r0.IntersectsWith(r1))
{
graphics.DrawString(d1, font, textBrush, newestRectangle, stringFormat);
}
if (2 > points.Count()) return;
var newest2 = OrderedItems[1];
var newest2Rectangle = new RectangleF(points[1].X, inner.Bottom, 100f, height);
// var d2 = MondaiResult.GetStringFromTimeSpan(EPuzzleTime.Now - newest2.StartTime);
var d2 = (EPuzzleTime.Now - newest2.StartTime).GetShortString();
var size2 = MeasureString(d2, font);
newest2Rectangle.X -= size2.Width / 2f;
var r2 = new RectangleF(newest2Rectangle.Left, newest2Rectangle.Top, size2.Width, size2.Height);
if (!(r0.IntersectsWith(r2) || r1.IntersectsWith(r2)))
{
graphics.DrawString(d2, font, textBrush, newest2Rectangle, stringFormat);
}
}