50 lines
1.2 KiB
C#
50 lines
1.2 KiB
C#
|
|
using System;
|
|||
|
|
using System.Collections.Generic;
|
|||
|
|
using System.Text;
|
|||
|
|
using System.Windows.Forms;
|
|||
|
|
|
|||
|
|
namespace ryPrint.Mod
|
|||
|
|
{
|
|||
|
|
public class RySet
|
|||
|
|
{
|
|||
|
|
/// <summary>
|
|||
|
|
/// 毫米转像素
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="mm"></param>
|
|||
|
|
/// <returns></returns>
|
|||
|
|
public static int MMtopixel(double mm)
|
|||
|
|
{
|
|||
|
|
return Convert.ToInt32(mm * 5);
|
|||
|
|
}
|
|||
|
|
/// <summary>
|
|||
|
|
/// 像素转毫米
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="pixel"></param>
|
|||
|
|
/// <returns></returns>
|
|||
|
|
public static float Pixeltomm(int pixel)
|
|||
|
|
{
|
|||
|
|
return pixel / 5f;
|
|||
|
|
}
|
|||
|
|
/// <summary>
|
|||
|
|
/// 毫米转英寸
|
|||
|
|
/// </summary>
|
|||
|
|
/// <returns></returns>
|
|||
|
|
public static float MMToInches(double mm)
|
|||
|
|
{
|
|||
|
|
return (float)(0.0393701 * mm);
|
|||
|
|
}
|
|||
|
|
/// <summary>
|
|||
|
|
/// 英寸转毫米
|
|||
|
|
/// </summary>
|
|||
|
|
/// <returns></returns>
|
|||
|
|
public static float InchesTomm(decimal Inches)
|
|||
|
|
{
|
|||
|
|
return (float)(Inches/0.0393701m);
|
|||
|
|
}
|
|||
|
|
public static string GetTruePath(string path)
|
|||
|
|
{
|
|||
|
|
return path.Replace("<app>", Application.StartupPath);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|