FastReport

Форк
0
53 строки · 2.3 Кб
1
using FastReport.Utils;
2
using System;
3
using System.Drawing;
4

5
namespace FastReport.Gauge.Radial
6
{
7
    internal class RadialUtils
8
    {
9
        public static Font GetFont(FRPaintEventArgs e, GaugeObject gauge, Font font)
10
        {
11
            return e.Cache.GetFont(font.FontFamily, gauge.IsPrinting ? font.Size : font.Size * e.ScaleX * 96f / DrawUtils.ScreenDpi, font.Style);
12
        }
13
        public static SizeF GetStringSize(FRPaintEventArgs e, GaugeObject gauge, Font font, string text)
14
        {
15
            return e.Graphics.MeasureString(text, GetFont(e, gauge, font));
16
        }
17

18
        public static PointF[] RotateVector(PointF[] vector, double angle, PointF center)
19
        {
20
            PointF[] rotatedVector = new PointF[2];
21
            rotatedVector[0].X = (float)(center.X + (vector[0].X - center.X) * Math.Cos(angle) + (center.Y - vector[0].Y) * Math.Sin(angle));
22
            rotatedVector[0].Y = (float)(center.Y + (vector[0].X - center.X) * Math.Sin(angle) + (vector[0].Y - center.Y) * Math.Cos(angle));
23
            rotatedVector[1].X = (float)(center.X + (vector[1].X - center.X) * Math.Cos(angle) + (center.Y - vector[1].Y) * Math.Sin(angle));
24
            rotatedVector[1].Y = (float)(center.Y + (vector[1].X - center.X) * Math.Sin(angle) + (vector[1].Y - center.Y) * Math.Cos(angle));
25
            return rotatedVector;
26
        }
27

28
        public static bool IsTop(GaugeObject radialGauge)
29
        {
30
            return ((radialGauge as RadialGauge).Position & RadialGaugePosition.Top) != 0;
31
        }
32
        public static bool IsBottom(GaugeObject radialGauge)
33
        {
34
            return ((radialGauge as RadialGauge).Position & RadialGaugePosition.Bottom) != 0;
35
        }
36
        public static bool IsLeft(GaugeObject radialGauge)
37
        {
38
            return ((radialGauge as RadialGauge).Position & RadialGaugePosition.Left) != 0;
39
        }
40
        public static bool IsRight(GaugeObject radialGauge)
41
        {
42
            return ((radialGauge as RadialGauge).Position & RadialGaugePosition.Right) != 0;
43
        }
44
        public static bool IsSemicircle(GaugeObject radialGauge)
45
        {
46
            return ((radialGauge as RadialGauge).Type & RadialGaugeType.Semicircle) != 0;
47
        }
48
        public static bool IsQuadrant(GaugeObject radialGauge)
49
        {
50
            return ((radialGauge as RadialGauge).Type & RadialGaugeType.Quadrant) != 0;
51
        }
52
    }
53
}
54

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.