Common.cs 1.1 KB
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;
        }



    }
}