FastReport
53 строки · 2.3 Кб
1using FastReport.Utils;2using System;3using System.Drawing;4
5namespace FastReport.Gauge.Radial6{
7internal class RadialUtils8{9public static Font GetFont(FRPaintEventArgs e, GaugeObject gauge, Font font)10{11return e.Cache.GetFont(font.FontFamily, gauge.IsPrinting ? font.Size : font.Size * e.ScaleX * 96f / DrawUtils.ScreenDpi, font.Style);12}13public static SizeF GetStringSize(FRPaintEventArgs e, GaugeObject gauge, Font font, string text)14{15return e.Graphics.MeasureString(text, GetFont(e, gauge, font));16}17
18public static PointF[] RotateVector(PointF[] vector, double angle, PointF center)19{20PointF[] rotatedVector = new PointF[2];21rotatedVector[0].X = (float)(center.X + (vector[0].X - center.X) * Math.Cos(angle) + (center.Y - vector[0].Y) * Math.Sin(angle));22rotatedVector[0].Y = (float)(center.Y + (vector[0].X - center.X) * Math.Sin(angle) + (vector[0].Y - center.Y) * Math.Cos(angle));23rotatedVector[1].X = (float)(center.X + (vector[1].X - center.X) * Math.Cos(angle) + (center.Y - vector[1].Y) * Math.Sin(angle));24rotatedVector[1].Y = (float)(center.Y + (vector[1].X - center.X) * Math.Sin(angle) + (vector[1].Y - center.Y) * Math.Cos(angle));25return rotatedVector;26}27
28public static bool IsTop(GaugeObject radialGauge)29{30return ((radialGauge as RadialGauge).Position & RadialGaugePosition.Top) != 0;31}32public static bool IsBottom(GaugeObject radialGauge)33{34return ((radialGauge as RadialGauge).Position & RadialGaugePosition.Bottom) != 0;35}36public static bool IsLeft(GaugeObject radialGauge)37{38return ((radialGauge as RadialGauge).Position & RadialGaugePosition.Left) != 0;39}40public static bool IsRight(GaugeObject radialGauge)41{42return ((radialGauge as RadialGauge).Position & RadialGaugePosition.Right) != 0;43}44public static bool IsSemicircle(GaugeObject radialGauge)45{46return ((radialGauge as RadialGauge).Type & RadialGaugeType.Semicircle) != 0;47}48public static bool IsQuadrant(GaugeObject radialGauge)49{50return ((radialGauge as RadialGauge).Type & RadialGaugeType.Quadrant) != 0;51}52}53}
54