Common.cs
1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PrintLabel
{
public static class Common
{
internal static List<Model.ClsLabel> Label;
internal static BLL.LabelPrint LabelPrint;
/// <summary>
/// 像素毫米转换的倍数
/// </summary>
public static float MULTIPLE = 203f;//203f
/// <summary>
/// 添加标签时初始的大小,mm
/// </summary>
public const string LABEL_SIZE = "50,70";
/// <summary>
/// 毫米转像素
/// </summary>
/// <param name="mm"></param>
/// <returns></returns>
internal static float MMToPx(float mm)
{
return mm / 25.4f * MULTIPLE;
}
/// <summary>
/// 像素转毫米
/// </summary>
/// <param name="px"></param>
/// <returns></returns>
internal static float PxToMM(float px)
{
return px / MULTIPLE * 25.4f;
}
}
}