LunarMind/PaperInfo.cs

(开头部分) 5KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SHomeWorkshop.LunarMind
{
    /// <summary>
    /// 纸张信息。由物理纸张尺寸转化为WPF纸张尺寸(96DPI下)。
    /// </summary>
    public class PaperInfo
    {
        /// <summary>
        /// 构造方法。
        /// </summary>
        /// <param name="name">纸张类型名称。例如:A4</param>
        /// <param name="shortSideWPFUnit">会自动取“shortSideWPFUnit”和“longSideWPFUnit”这两个参数中较小的值来初始化“ShortSideWPFUnit”属性。</param>
        /// <param name="longSideWPFUnit">会自动取“shortSideWPFUnit”和“longSideWPFUnit”这两个参数中较大的值来初始化“LongSideWPFUnit”属性。</param>
        /// <param name="shortSidePixcelCount">与前两个参数类似,后两个参数也会自动比较大小。</param>
        /// <param name="longSidePixcelCount">与前两个参数类似,后两个参数也会自动比较大小。</param>
        public PaperInfo(string name, double shortSideWPFUnit, double longSideWPFUnit,
            int shortSidePixcelCount, int longSidePixcelCount)
        {
            paperTypeName = name;

            if (shortSideWPFUnit < longSideWPFUnit)
            {
                this.shortSideWPFUnit = shortSideWPFUnit;
                this.longSideWPFUnit = longSideWPFUnit;
            }
            else
            {
                this.shortSideWPFUnit = longSideWPFUnit;
                this.longSideWPFUnit = shortSideWPFUnit;
            }

            if (shortSidePixcelCount < longSidePixcelCount)
            {
                this.shortSidePixcelCount = shortSidePixcelCount;
                this.longSidePixcelCount = longSidePixcelCount;
            }
            else
            {
                this.shortSidePixcelCount = longSidePixcelCount;
                this.longSidePixcelCount = shortSidePixcelCount;
            }
        }

        private static List<PaperInfo> paperInfos = new List<PaperInfo>();

        static PaperInfo()
        {
            paperInfos.Add(new PaperInfo("A0", 4493.9, 3178.6, 14043, 9933));
            paperInfos.Add(new PaperInfo("A1", 3178.6, 2245.0, 9933, 7015));
            paperInfos.Add(new PaperInfo("A2", 2245.0, 1587.4, 7015, 4960));
            paperInfos.Add(new PaperInfo("A3", 1587.4, 1122.5, 4960, 3507));
            paperInfos.Add(new PaperInfo("A4", 793.7, 1122.5, 2480, 3507));
            paperInfos.Add(new PaperInfo("A5", 559.4, 793.7, 1748, 2480));
            paperInfos.Add(new PaperInfo("A6", 396.9, 559.4, 1240, 1748));
后面还有 84 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。