コード例 #1
0
ファイル: PieItem.cs プロジェクト: pranart/Cross.Pie
 void DrawText(string text, ICanvas canvas, NGraphics.Point center, double radius, NGraphics.Font font, Xamarin.Forms.Color textColor, double middleRadian)
 {
     if (!string.IsNullOrWhiteSpace(text))
     {
         double          textRadius = radius * 0.67;
         NGraphics.Point centerText = new NGraphics.Point(center.X + Math.Cos(middleRadian) * textRadius, center.Y + Math.Sin(middleRadian) * textRadius);
         const double    width      = 40;
         const double    height     = 5;
         Rect            rect       = new Rect(centerText.X - width / 2.0, centerText.Y, width, height);
         canvas.DrawText(text, rect, font, NGraphics.TextAlignment.Center, new Pen(textColor.ToCross()), new SolidBrush(textColor.ToCross()));
     }
 }