ホテル管理システム
ogi
yesterday 1a1c8e71fcd14858f595029f089b2d4a00202b32
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
48
49
50
51
52
53
using System.Collections.Generic;
using System.ComponentModel;
 
namespace HotelPms.Share.Windows.Report.Member
{
    public class PrintRow
    {
        /// <summary>
        /// 行のセル毎印刷情報
        /// </summary>
        public List<Cell> Cells {  get; set; } = new List<Cell>();
 
        /// <summary>
        /// ディフォルトプロパティ
        /// </summary>
        /// <param name="index"></param>
        /// <returns></returns>
        public Cell this[int index] { get { return Cells[index]; } }
 
        /// <summary>
        /// 行の最大Y - 最小Y
        /// </summary>
        /// <param name="def"></param>
        /// <returns></returns>
        public float GetHeight(float def)
        {
            float rowHeight = def;
            if (Cells.Count > 0)
            {
                float minY = 0F;
                float maxY = 0F;
                int i = 0;
                foreach (Cell cell in Cells)
                {
                    if (cell.Style == null) { continue; }
                    if (i == 0)
                    {
                        minY = cell.Style.Top;
                        maxY = cell.Style.Top + cell.Style.Height;
                    }
                    else
                    {
                        if (minY > cell.Style.Top) { minY = cell.Style.Top; }
                        if (maxY < (cell.Style.Top + cell.Style.Height)) { maxY = cell.Style.Top + cell.Style.Height; }
                    }
                    i++;
                }
                rowHeight = maxY - minY;
            }
            return rowHeight;
        }
    }
}