當前位置: 首頁>>代碼示例>>C#>>正文


C# PointF.Any方法代碼示例

本文整理匯總了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);
            }
        }
開發者ID:kaijin-games,項目名稱:larning-english-game,代碼行數:53,代碼來源:KirokuBox2.cs


注:本文中的System.Drawing.PointF.Any方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。